From b727b733aa370d66d9e4c499f449a783219478ac Mon Sep 17 00:00:00 2001 From: Nabil Ould Hamou <38989045+NabilOuldHamou@users.noreply.github.com> Date: Mon, 9 Dec 2024 15:58:06 +0100 Subject: [PATCH 1/4] Delete .idea directory --- .idea/.gitignore | 8 --- .idea/Project.iml | 12 ---- .idea/codeStyles/Project.xml | 63 -------------------- .idea/codeStyles/codeStyleConfig.xml | 5 -- .idea/inspectionProfiles/Project_Default.xml | 6 -- .idea/modules.xml | 8 --- .idea/prettier.xml | 6 -- .idea/vcs.xml | 4 -- 8 files changed, 112 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/Project.iml delete mode 100644 .idea/codeStyles/Project.xml delete mode 100644 .idea/codeStyles/codeStyleConfig.xml delete mode 100644 .idea/inspectionProfiles/Project_Default.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/prettier.xml delete mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/Project.iml b/.idea/Project.iml deleted file mode 100644 index 24643cc..0000000 --- a/.idea/Project.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index 5055868..0000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index 79ee123..0000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 03d9549..0000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 74f1bcb..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/prettier.xml b/.idea/prettier.xml deleted file mode 100644 index b0c1c68..0000000 --- a/.idea/prettier.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index d843f34..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file From 12835a26c6bb3eea1d4bef77428b79a2fb6aacf0 Mon Sep 17 00:00:00 2001 From: Nabil Ould Hamou Date: Mon, 9 Dec 2024 16:02:40 +0100 Subject: [PATCH 2/4] updated .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index c92aacb..65babd0 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ node_modules /.svelte-kit /build +.idea + # OS .DS_Store Thumbs.db From e09f30bff3b6289419db88b427134c9bdf1790ef Mon Sep 17 00:00:00 2001 From: Nabil Ould Hamou Date: Mon, 9 Dec 2024 16:08:15 +0100 Subject: [PATCH 3/4] fixed problem with id not saving in cookies when creating an account --- src/routes/+layout.server.ts | 20 ++++++++++++-------- src/routes/api/auth/register/+server.ts | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts index 9b71e0b..61c1489 100644 --- a/src/routes/+layout.server.ts +++ b/src/routes/+layout.server.ts @@ -4,16 +4,20 @@ export async function load({ locals, url, fetch }) { const token = locals.token; if (token == undefined && url.pathname !== "/") { - redirect(301, "/"); + redirect(301, '/'); } - const res = await fetch(`/api/users/${locals.userId}`, { - method: 'GET', - headers: { - 'Content-Type': 'application/json' - } - }); - const user = await res.json(); + let user = null; + if (locals.userId !== undefined) { + const res = await fetch(`/api/users/${locals.userId}`, { + method: 'GET', + headers: { + 'Content-Type': 'application/json' + } + }); + + user = await res.json(); + } return { token, user } diff --git a/src/routes/api/auth/register/+server.ts b/src/routes/api/auth/register/+server.ts index 674d547..dfbb955 100644 --- a/src/routes/api/auth/register/+server.ts +++ b/src/routes/api/auth/register/+server.ts @@ -44,7 +44,7 @@ export async function POST({request}) { // @ts-ignore const token = jwt.sign(newUser, process.env.JWT_SECRET, { expiresIn: "1h" }); logger.debug(`Generated a JWT token for user ${newUser.email}.`) - return json({token: token}); + return json({token: token, userId: newUser.id}); } catch (e) { logger.error(e); From 72f116f55325376e18f072ea5f513b202d5b3715 Mon Sep 17 00:00:00 2001 From: Nabil Ould Hamou Date: Mon, 9 Dec 2024 16:40:30 +0100 Subject: [PATCH 4/4] fixed image --- src/lib/components/Message.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/Message.svelte b/src/lib/components/Message.svelte index d5fcc43..d8a98d6 100644 --- a/src/lib/components/Message.svelte +++ b/src/lib/components/Message.svelte @@ -34,7 +34,7 @@
Profile Picture