});
socket.on('close', () => {
- console.log('Connection droped! Restarting...')
+ console.log('Connection droped! Restarting...');
+ auth = false;
initSession();
});
-import { reactive, toRefs, ref } from 'vue';
+import { reactive, toRefs } from 'vue';
import { useIpc } from './ipc';
interface AuthState {
const AUTH_KEY = 'crimata_token';
-const token = window.localStorage.getItem(AUTH_KEY);
+let token: string | null;
+
+token = window.localStorage.getItem(AUTH_KEY);
if (token) {
state.accessToken = token;
window.localStorage.setItem(AUTH_KEY, token);
const authToken = async () => {
const { invoke } = useIpc();
try {
+ token = window.localStorage.getItem(AUTH_KEY);
const res = await invoke('auth-session', token);
window.localStorage.setItem(AUTH_KEY, res);
state.accessToken = res;