浏览代码

Debugging

ghorsington 4 年之前
父节点
当前提交
50ec57aa4b
共有 2 个文件被更改,包括 3 次插入0 次删除
  1. 1 0
      web/src/routes/_layout.svelte
  2. 2 0
      web/src/routes/login/check.ts

+ 1 - 0
web/src/routes/_layout.svelte

@@ -11,6 +11,7 @@
   ) {
     const authResult = await this.fetch("/login/check");
     const result = (await authResult.json()) as AuthInfo;
+    console.log(result);
     if (path.startsWith("/login/")) {
       if (result.loggedIn) {
         return this.redirect(302, "/");

+ 2 - 0
web/src/routes/login/check.ts

@@ -8,6 +8,8 @@ export interface AuthInfo {
 
 type CheckResult = Promise<ExpressResponse<CheckResult>>;
 export const get = async (req: ExpressRequest, res: ExpressResponse): CheckResult => {
+    console.log(req.session);
+    console.log(req.session?.userId);
     if (!req.session?.userId) {
         return res.json({
             loggedIn: false,