This commit is contained in:
BurnLP2013 2024-07-09 11:37:20 +02:00
commit af056c0dec

View file

@ -1,8 +1,15 @@
import { reactive } from 'vue';
export const store = reactive<{token: string | null, setToken: (token: string | null) => void}>({
token: null,
setToken: (token: string | null) => store.token = token
token: localStorage.getItem('token') || null,
setToken: (token: string | null) => {
store.token = token
if (token) {
localStorage.setItem('token', token)
} else{
localStorage.removeItem('token')
}
}
});