Browse Source

Merge branch 'development'

Lee Morgan 1 tháng trước cách đây
mục cha
commit
d67dcdee98

+ 7 - 3
src/routes/(app)/dashboard/+page.server.js

@@ -1,11 +1,15 @@
 import {PUBLIC_API_URL} from "$env/static/public";
 import {error} from "@sveltejs/kit";
 
-export async function load({fetch}){
+export async function load({fetch, cookies}){
+    const userCookie = cookies.get("user");
+
     const res = await fetch(`${PUBLIC_API_URL}/user`, {
         method: "GET",
-        headers: {"Content-Type": "application/json"},
-        credentials: "include"
+        headers: {
+            "Content-Type": "application/json",
+            "Cookie": `user=${userCookie}`
+        }
     });
 
     const data = await res.json();

+ 7 - 3
src/routes/(app)/game/+page.server.js

@@ -1,11 +1,15 @@
 import {PUBLIC_API_URL} from "$env/static/public";
 import {error} from "@sveltejs/kit";
 
-export async function load({fetch}){
+export async function load({fetch, cookies}){
+    const userCookie = cookies.get("user");
+
     const res = await fetch(`${PUBLIC_API_URL}/game`, {
         method: "GET",
-        headers: {"Content-Type": "application/json"},
-        credentials: "include"
+        headers: {
+            "Content-Type": "application/json",
+            "Cookie": `user=${userCookie}`
+        }
     });
 
     const data = await res.json();

+ 6 - 3
src/routes/(app)/game/[game_id]/+page.server.js

@@ -1,13 +1,16 @@
 import {PUBLIC_API_URL} from "$env/static/public";
 import {error} from "@sveltejs/kit";
 
-export async function load({fetch, params}){
+export async function load({fetch, params, cookies}){
     const {game_id} = params;
+    const userCookie = cookies.get("user");
 
     const response = await fetch(`${PUBLIC_API_URL}/game/${game_id}`, {
         method: "GET",
-        headers: {"Content-Type": "application/json"},
-        credentials: "include"
+        headers: {
+            "Content-Type": "application/json",
+            "Cookie": `user=${userCookie}`
+        }
     });
 
     const data = await response.json();