mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-22 06:49:35 +00:00
[review, add time modal]
This commit is contained in:
1 parent
90cd75349c
commit
17a044b118
19 files changed
+228
-158
No files matched your search
@@ -4,18 +4,13 @@ import './refreshExpired'
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
status: '',
|
||||
_token: localStorage.getItem('wzo_vue_user_token') || '',
|
||||
token: localStorage.getItem('wzo_vue_user_token') || '',
|
||||
user: JSON.parse(localStorage.getItem('wzo_vue_user_user') || '{}'),
|
||||
},
|
||||
mutations: {
|
||||
auth_request(state: any) {
|
||||
state.status = 'loading'
|
||||
},
|
||||
auth_success(state: any, data: any) {
|
||||
state.status = 'success'
|
||||
if (data.token) {
|
||||
state._token = data.token
|
||||
state.token = data.token
|
||||
localStorage.setItem('wzo_vue_user_token', data.token)
|
||||
}
|
||||
|
||||
@@ -25,24 +20,21 @@ export default {
|
||||
}
|
||||
},
|
||||
auth_error(state: any) {
|
||||
state.status = 'error'
|
||||
state._token = ''
|
||||
state.token = ''
|
||||
localStorage.removeItem('wzo_vue_user_token')
|
||||
localStorage.removeItem('wzo_vue_user_user')
|
||||
},
|
||||
logout(state: any) {
|
||||
state.status = ''
|
||||
state._token = ''
|
||||
state.token = ''
|
||||
state.user = null
|
||||
localStorage.removeItem('wzo_vue_user_token')
|
||||
localStorage.removeItem('wzo_vue_user_user')
|
||||
window.open(location.origin, "_self")
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
login({commit}: {commit: any}, credentials: any) {
|
||||
return new Promise((resolve, reject) => {
|
||||
commit('auth_request')
|
||||
|
||||
axios.post_data('v1/auth/login', credentials)
|
||||
.then((response: any) => {
|
||||
const token = response.token
|
||||
@@ -81,6 +73,7 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
// eslint-disable-next-line
|
||||
logout({commit}: {commit: any}) {
|
||||
return new Promise((resolve) => {
|
||||
axios.post_auth_data('v1/auth/invalidate')
|
||||
@@ -90,14 +83,16 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
forgotPassword(credentials: any) {
|
||||
// eslint-disable-next-line
|
||||
forgotPassword({commit}: {commit: any}, credentials: any) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.post_auth_data('v1/auth/forgot', credentials)
|
||||
.then(response => resolve(response))
|
||||
.catch(error => reject(error))
|
||||
})
|
||||
},
|
||||
resetPassword(credentials: any) {
|
||||
// eslint-disable-next-line
|
||||
resetPassword({commit}: {commit: any}, credentials: any) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.post_auth_data('v1/auth/reset', credentials)
|
||||
.then(response => resolve(response))
|
||||
@@ -157,17 +152,13 @@ export default {
|
||||
},
|
||||
getters: {
|
||||
isLoggedIn: (state: any) => {
|
||||
return !!state._token
|
||||
return !!state.token
|
||||
},
|
||||
// authStatus: (state: any) => {
|
||||
// return state.status
|
||||
// },
|
||||
user: (state: any) => {
|
||||
return state.user
|
||||
},
|
||||
token: (state: any) => {
|
||||
return state.token
|
||||
}
|
||||
// token: (state: any) => {
|
||||
// return state._token
|
||||
|
||||
// }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user