mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
.
This commit is contained in:
1 parent
ae33df38e4
commit
012a9ec926
5 files changed
+10
-4
No files matched your search
@@ -85,7 +85,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
async logOut() {
|
async logOut() {
|
||||||
try {
|
try {
|
||||||
await this.$store.dispatch('wAuth/logout')
|
await this.$store.dispatch('auth/logout')
|
||||||
this.$router.push('/')
|
this.$router.push('/')
|
||||||
this.$toast.success('Boli ste odhlásený')
|
this.$toast.success('Boli ste odhlásený')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export default {
|
|||||||
if (!(await this.v$.$validate())) return console.log(this.v$)
|
if (!(await this.v$.$validate())) return console.log(this.v$)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.$axios.post_data('v1/auth/login', this.form)
|
await this.$store.dispatch('auth/login', this.form)
|
||||||
this.$router.push({ name: 'Overview - Ongoing tasks'})
|
this.$router.push({ name: 'Overview - Ongoing tasks'})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$toast.error(error)
|
this.$toast.error(error)
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ export default {
|
|||||||
async updateUserInfo() {
|
async updateUserInfo() {
|
||||||
if (!(await this.v$.$validate())) return
|
if (!(await this.v$.$validate())) return
|
||||||
try {
|
try {
|
||||||
await this.$store.dispatch('wAuth/updateUserInfo', this.user)
|
await this.$store.dispatch('auth/updateUserInfo', this.user)
|
||||||
|
|
||||||
this.$toast.success('Profil bol úspešne zmenený')
|
this.$toast.success('Profil bol úspešne zmenený')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ export default {
|
|||||||
state.user = data.user
|
state.user = data.user
|
||||||
localStorage.setItem('wzo_vue_user_user', JSON.stringify(data.user))
|
localStorage.setItem('wzo_vue_user_user', JSON.stringify(data.user))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(state)
|
||||||
},
|
},
|
||||||
auth_error(state: any) {
|
auth_error(state: any) {
|
||||||
state.token = ''
|
state.token = ''
|
||||||
@@ -158,7 +160,7 @@ export default {
|
|||||||
return state.user
|
return state.user
|
||||||
},
|
},
|
||||||
token: (state: any) => {
|
token: (state: any) => {
|
||||||
return state.token
|
return (state.token && state.token != undefined) ? state.token : null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,6 +149,10 @@ export default {
|
|||||||
_config(config: any) {
|
_config(config: any) {
|
||||||
if (config) console.error('NOT IMPLEMENTED')
|
if (config) console.error('NOT IMPLEMENTED')
|
||||||
|
|
||||||
|
if (!store.getters['auth/token']) {
|
||||||
|
return {headers: {}}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${store.getters['auth/token']}`
|
Authorization: `Bearer ${store.getters['auth/token']}`
|
||||||
|
|||||||
Reference in new issue
Block a user