From 1d00e5ffe7dcb030263cc6bfe8acc353eeeb17a6 Mon Sep 17 00:00:00 2001 From: Miranda Zheng <123515762+mirmirmirr@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:36:14 -0500 Subject: [PATCH] dashboard cleaning --- src/pages/Dashboard.jsx | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/pages/Dashboard.jsx b/src/pages/Dashboard.jsx index f93951ca..5b0aab6a 100644 --- a/src/pages/Dashboard.jsx +++ b/src/pages/Dashboard.jsx @@ -16,7 +16,7 @@ function deleteAllCookies() { } const check_user = async (dataToUse) => { - const cookies = document.cookie; // Get all cookies as a single string + const cookies = document.cookie; const cookieObj = {}; cookies.split(';').forEach((cookie) => { @@ -27,7 +27,7 @@ const check_user = async (dataToUse) => { const parsedValue = JSON.parse(decodeURIComponent(value)); cookieObj[key] = String(parsedValue); } catch { - cookieObj[key] = String(decodeURIComponent(value)); // Handle plain strings + cookieObj[key] = String(decodeURIComponent(value)); } } }); @@ -86,6 +86,7 @@ export default function Dashboard() { } document.body.removeChild(textArea); + // Please uncomment this when the server does have HTTPS certifications // try { // navigator.clipboard.writeText(event.code).then(() => { // setNotification('Link copied to clipboard'); @@ -107,16 +108,12 @@ export default function Dashboard() { }; const handleEditEvent = async (event) => { - console.log('ran'); - console.log(event); try { const codeChange = `code=${encodeURIComponent(JSON.stringify(event.code))}; path=/;`; document.cookie = codeChange; navigate('/availability', { state: { eventName2: event.title, isUpdating: true }, }); - // console.log(event); - // navigate(data.editUrl); } catch (error) { console.error('Error editing availability:', error); } @@ -124,12 +121,9 @@ export default function Dashboard() { const get_all_events = async () => { const data = { - // email: 'testing@gmail.com', - // password: '123', }; check_user(data); - console.log(data); try { const response = await fetch( @@ -145,8 +139,6 @@ export default function Dashboard() { if (response.ok) { const result = await response.json(); - console.log('Events retrieved successfully', result); - console.log(result); const createdEvents = result.my_events; const participatingEvents = result.other_events; @@ -162,11 +154,10 @@ export default function Dashboard() { } setArrayTwo(alpha); - // console.log(mockIndividualEvents); + id = 1; var beta = []; for (const [key, value] of Object.entries(participatingEvents)) { - console.log(key, value); const myDictionary = {}; myDictionary.id = id; myDictionary.code = key;