Merge branch 'main' of https://git.missing.ninja/LF2/Alisa
This commit is contained in:
commit
af056c0dec
1 changed files with 9 additions and 2 deletions
|
@ -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')
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue