fix splash screen

This commit is contained in:
riqo 2021-03-04 10:36:53 -06:00
commit c7f91d3e6b
8 changed files with 61 additions and 77 deletions

View file

@ -11,8 +11,6 @@ const state = reactive<AuthState>({
error: undefined,
});
const loading = ref(true);
const AUTH_KEY = 'crimata_token';
const token = window.localStorage.getItem(AUTH_KEY);
@ -22,7 +20,6 @@ if (token) {
}
const authToken = async () => {
loading.value = true;
const { invoke } = useIpc();
try {
const res = await invoke('auth-session', token);
@ -35,7 +32,6 @@ const authToken = async () => {
window.localStorage.removeItem(AUTH_KEY);
state.accessToken = null;
}
loading.value = false;
}
// authenticate on auth event
@ -60,6 +56,5 @@ export const useAuth = () => {
setToken,
logout,
...toRefs(state), // accessToken, error
loading
}
}