Add nuxt auth module

This commit is contained in:
2020-04-23 00:09:37 +02:00
parent f0b5682a25
commit 0096fb0a00
9 changed files with 98 additions and 125 deletions
+3 -23
View File
@@ -1,27 +1,7 @@
import {clearToken, setToken} from "@/services/LocalStorageService";
export const state = () => ({})
export const state = () => ({
token: ''
})
export const mutations = {
setToken(state, token) {
state.token = token
setToken(token)
},
clearToken(state) {
state.token = null
clearToken()
},
initToken(state) {
state.token = localStorage.getItem('token')
}
}
export const mutations = {}
export const actions = {}
export const getters = {
isLoggedIn(state) {
return state.token !== null && state.token !== ''
}
}
export const getters = {}