From 71f74a3ad55570fbb84601480b8b91af967c670c Mon Sep 17 00:00:00 2001 From: Phil Wing Date: Sun, 5 Jan 2025 16:08:47 -0600 Subject: [PATCH] Fixed complete/incomplete list items --- src/api.js | 41 ++++++ .../DashboardComponents/MultiplayerToggle.vue | 117 ++++++++++++++++++ src/components/ListItems/ListElement.css | 4 +- src/components/ListItems/ListElement.vue | 40 +++--- src/views/Dashboard.vue | 38 +++--- 5 files changed, 205 insertions(+), 35 deletions(-) create mode 100644 src/components/DashboardComponents/MultiplayerToggle.vue diff --git a/src/api.js b/src/api.js index 8034527..26fda65 100644 --- a/src/api.js +++ b/src/api.js @@ -26,6 +26,29 @@ export async function createList(listData) { } } +// API call to create a new list +export async function getList(listData) { + const { sessionId } = store.state; + + console.log(axios); + + if (!sessionId) { + throw new Error('No session ID found. User may not be authenticated.'); + } + + try { + const response = await axios.post( + '/lists/', + listData, + { headers: { 'Authorization': `Bearer ${sessionId}` } } + ); + return response.data; + } catch (error) { + console.warn('Error creating list:', error,...arguments); + throw error; + } +} + // Example function for other list-related actions // Add more functions as needed @@ -46,3 +69,21 @@ export async function deleteList(listId) { throw error; } } + +export async function axiosGet(url, params = {}, sessionId) { + return axios.get(url, { + params, // Query parameters + headers: { + 'Authorization': `Bearer ${sessionId}` + } + }); +} + +export async function axiosPost(url, data = {}, sessionId) { + return axios.post(url, data, { + headers: { + 'Authorization': `Bearer ${sessionId}`, + 'Content-Type': 'application/json' + } + }); +} diff --git a/src/components/DashboardComponents/MultiplayerToggle.vue b/src/components/DashboardComponents/MultiplayerToggle.vue new file mode 100644 index 0000000..658ff23 --- /dev/null +++ b/src/components/DashboardComponents/MultiplayerToggle.vue @@ -0,0 +1,117 @@ + + + + diff --git a/src/components/ListItems/ListElement.css b/src/components/ListItems/ListElement.css index e843b34..bc64ee3 100644 --- a/src/components/ListItems/ListElement.css +++ b/src/components/ListItems/ListElement.css @@ -33,12 +33,12 @@ text-decoration: none; display: block; font-size: 14px; - text-decoration: line-through; + text-decoration: none; } .dropdown-content a:hover { background-color: grey; - text-decoration: none; + text-decoration: line-through; } .dropdown:hover .dropdown-content { diff --git a/src/components/ListItems/ListElement.vue b/src/components/ListItems/ListElement.vue index 9eaf646..52752bf 100644 --- a/src/components/ListItems/ListElement.vue +++ b/src/components/ListItems/ListElement.vue @@ -7,7 +7,6 @@ spellcheck="false"> {{ listName }} -
@@ -32,7 +31,7 @@