1
0

Added link sharing (#30)

This commit is contained in:
konrad
2019-09-09 17:55:43 +00:00
committed by Gitea
parent 857c283fb7
commit d83fb24bbd
18 changed files with 397 additions and 41 deletions

View File

@ -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()