frontend: add useAuthHandlers in main.js
This commit is contained in:
parent
d0a61450c5
commit
243036f29e
2 changed files with 3 additions and 4 deletions
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue