Added link sharing #30
|
@ -7,7 +7,8 @@ export default {
|
|||
|
||||
user: {
|
||||
authenticated: false,
|
||||
infos: {}
|
||||
infos: {},
|
||||
isLinkShareAuth: false,
|
||||
},
|
||||
|
||||
login(context, creds, redirect) {
|
||||
|
@ -74,6 +75,17 @@ export default {
|
|||
this.user.authenticated = false
|
||||
},
|
||||
|
||||
async linkShareAuth(context, hash) {
|
||||
HTTP.post('/shares/'+hash+'/auth')
|
||||
.then(r => {
|
||||
localStorage.setItem('token', r.data.token)
|
||||
this.user.isLinkShareAuth = true
|
||||
return Promise.resolve(r)
|
||||
}).catch(e => {
|
||||
return Promise.reject(e)
|
||||
})
|
||||
},
|
||||
|
||||
checkAuth() {
|
||||
let jwt = localStorage.getItem('token')
|
||||
this.getUserInfos()
|
||||
|
|
41
src/components/sharing/linkSharingAuth.vue
Normal file
41
src/components/sharing/linkSharingAuth.vue
Normal file
|
@ -0,0 +1,41 @@
|
|||
<template>
|
||||
<div class="message is-info" v-if="loading">
|
||||
Authenticating...
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import auth from '../../auth'
|
||||
import message from '../../message'
|
||||
|
||||
export default {
|
||||
name: 'linkSharingAuth',
|
||||
data() {
|
||||
return {
|
||||
hash: '',
|
||||
loading: true,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.auth()
|
||||
},
|
||||
methods: {
|
||||
auth() {
|
||||
auth.linkShareAuth(this, this.$route.params.share)
|
||||
.then(r => {
|
||||
this.loading = false
|
||||
// TODO: redirect
|
||||
// eslint-disable-next-line
|
||||
console.log(r)
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(e, this)
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -12,6 +12,7 @@ import ShowListComponent from '@/components/lists/ShowList'
|
|||
import NewListComponent from '@/components/lists/NewList'
|
||||
import EditListComponent from '@/components/lists/EditList'
|
||||
import ShowTasksInRangeComponent from '@/components/tasks/ShowTasksInRange'
|
||||
import LinkShareAuthComponent from '@/components/sharing/linkSharingAuth'
|
||||
// Namespace Handling
|
||||
import NewNamespaceComponent from '@/components/namespaces/NewNamespace'
|
||||
import EditNamespaceComponent from '@/components/namespaces/EditNamespace'
|
||||
|
@ -106,6 +107,11 @@ export default new Router({
|
|||
path: '/labels',
|
||||
name: 'listLabels',
|
||||
component: ListLabelsComponent
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/share/:share/auth',
|
||||
name: 'linkShareAuth',
|
||||
component: LinkShareAuthComponent
|
||||
},
|
||||
]
|
||||
})
|
Reference in New Issue
Block a user