Added link sharing (#30)
This commit is contained in:
parent
857c283fb7
commit
d83fb24bbd
18 changed files with 397 additions and 41 deletions
|
|
@ -7,7 +7,7 @@ export default {
|
|||
|
||||
user: {
|
||||
authenticated: false,
|
||||
infos: {}
|
||||
infos: {},
|
||||
},
|
||||
|
||||
login(context, creds, redirect) {
|
||||
|
|
@ -23,6 +23,7 @@ export default {
|
|||
|
||||
// Tell others the user is autheticated
|
||||
this.user.authenticated = true
|
||||
this.user.isLinkShareAuth = false
|
||||
const inf = this.getUserInfos()
|
||||
// eslint-disable-next-line
|
||||
console.log(inf)
|
||||
|
|
@ -74,6 +75,17 @@ export default {
|
|||
this.user.authenticated = false
|
||||
},
|
||||
|
||||
linkShareAuth(hash) {
|
||||
return HTTP.post('/shares/'+hash+'/auth')
|
||||
.then(r => {
|
||||
localStorage.setItem('token', r.data.token)
|
||||
this.getUserInfos()
|
||||
return Promise.resolve(r.data)
|
||||
}).catch(e => {
|
||||
return Promise.reject(e)
|
||||
})
|
||||
},
|
||||
|
||||
checkAuth() {
|
||||
let jwt = localStorage.getItem('token')
|
||||
this.getUserInfos()
|
||||
|
|
|
|||
Reference in a new issue