From 243036f29edd6091513b81b2884b1ae69d312172 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Thu, 5 May 2022 20:39:24 +0300 Subject: [PATCH] frontend: add useAuthHandlers in main.js --- frontend/src/auth.js | 4 +--- frontend/src/main.js | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/frontend/src/auth.js b/frontend/src/auth.js index 78710bf..5a37220 100644 --- a/frontend/src/auth.js +++ b/frontend/src/auth.js @@ -2,7 +2,7 @@ import gateway, { GatewayEventType } from "./gateway"; import { removeItem, setItem } from "./storage"; import { overlayStore } from "./stores"; -function useAuthHandlers() { +export function useAuthHandlers() { gateway.subscribe(GatewayEventType.Ready, () => { overlayStore.close("login"); overlayStore.close("createAccount"); @@ -24,5 +24,3 @@ export function logOut() { gateway.close(); gateway.dispatch(GatewayEventType.BadAuth, -1); } - -useAuthHandlers(); diff --git a/frontend/src/main.js b/frontend/src/main.js index ce56bee..ca0c24e 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -2,7 +2,7 @@ import Main from './components/Main.svelte'; import gateway from './gateway'; import { getItem, init } from './storage'; import logging from "./logging"; -import { authWithToken } from './auth'; +import { authWithToken, useAuthHandlers } from './auth'; import { initResponsiveHandlers } from './responsive'; window.__waffle = { @@ -12,6 +12,7 @@ window.__waffle = { init(); initResponsiveHandlers(); +useAuthHandlers(); authWithToken(getItem("token")); // Remove loading screen