From 4925a6530bdb1947eaf1ce05860819b1e73c0667 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 4 Jun 2024 00:45:56 -0700 Subject: [PATCH] fix: banner z index --- backend/apps/socket/main.py | 26 ++++++++++++------------- src/lib/components/common/Banner.svelte | 2 +- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/backend/apps/socket/main.py b/backend/apps/socket/main.py index 0cf0b5fc1..3fbfb8ae8 100644 --- a/backend/apps/socket/main.py +++ b/backend/apps/socket/main.py @@ -15,22 +15,20 @@ async def connect(sid, environ, auth): print("connect ", sid) user = None - data = decode_token(auth["token"]) + if auth and "token" in auth: + data = decode_token(auth["token"]) - if data is not None and "id" in data: - user = Users.get_user_by_id(data["id"]) + if data is not None and "id" in data: + user = Users.get_user_by_id(data["id"]) - if user: - USER_POOL[sid] = { - "id": user.id, - "name": user.name, - "email": user.email, - "role": user.role, - } - print(f"user {user.name}({user.id}) connected with session ID {sid}") - else: - print("Authentication failed. Disconnecting.") - await sio.disconnect(sid) + if user: + USER_POOL[sid] = { + "id": user.id, + "name": user.name, + "email": user.email, + "role": user.role, + } + print(f"user {user.name}({user.id}) connected with session ID {sid}") @sio.event diff --git a/src/lib/components/common/Banner.svelte b/src/lib/components/common/Banner.svelte index 64a7a2054..6b5a4b752 100644 --- a/src/lib/components/common/Banner.svelte +++ b/src/lib/components/common/Banner.svelte @@ -39,7 +39,7 @@ {#if !dismissed} {#if mounted}