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
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/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 @@
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);