Implement GQL logout in admin interface

This commit is contained in:
Wolfgang Huß 2022-10-12 16:46:46 +02:00
parent 6d06c0f2d8
commit 34ec593f21
2 changed files with 23 additions and 4 deletions

View File

@ -28,14 +28,26 @@
</template>
<script>
import CONFIG from '../config'
import { logout } from '../graphql/logout'
export default {
name: 'navbar',
methods: {
logout() {
window.location.assign(CONFIG.WALLET_URL)
// window.location = CONFIG.WALLET_URL
this.$store.dispatch('logout')
async logout() {
this.$apollo
.mutate({
mutation: logout,
})
.then(() => {
window.location.assign(CONFIG.WALLET_URL)
// window.location = CONFIG.WALLET_URL
this.$store.dispatch('logout')
})
.catch(() => {
window.location.assign(CONFIG.WALLET_URL)
// window.location = CONFIG.WALLET_URL
this.$store.dispatch('logout')
})
},
wallet() {
window.location = CONFIG.WALLET_AUTH_URL.replace('{token}', this.$store.state.token)

View File

@ -0,0 +1,7 @@
import gql from 'graphql-tag'
export const logout = gql`
mutation {
logout
}
`