remove loginAPI calls from store

This commit is contained in:
Moriz Wahl 2021-04-21 16:51:46 +02:00
parent 4a8ba8d385
commit 810bd6d0ba
4 changed files with 11 additions and 7 deletions

View File

@ -70,7 +70,6 @@
<script>
import NavbarToggleButton from '@/components/NavbarToggleButton'
import VueQrcode from 'vue-qrcode'
import loginAPI from '../../apis/loginAPI'
export default {
name: 'sidebar',
@ -102,10 +101,8 @@ export default {
showSidebar() {
this.$sidebar.displaySidebar(true)
},
async logout() {
//const result = await loginAPI.logout(this.$store.state.session_id)
this.$store.dispatch('logout')
this.$router.push('/login')
logout() {
this.$emit('logout')
},
},
}

View File

@ -1,7 +1,6 @@
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
import loginAPI from '../apis/loginAPI'
import communityAPI from '../apis/communityAPI'
import createPersistedState from 'vuex-persistedstate'

View File

@ -1,7 +1,7 @@
<template>
<div class="wrapper">
<notifications></notifications>
<side-bar>
<side-bar @logout="logout">
<template slot="links">
<b-nav-item href="#!" to="/overview">
<b-nav-text class="p-0 text-lg text-muted">{{ $t('send') }}</b-nav-text>
@ -36,6 +36,7 @@
<script>
import PerfectScrollbar from 'perfect-scrollbar'
import 'perfect-scrollbar/css/perfect-scrollbar.css'
import loginAPI from '../../apis/loginAPI'
function hasElement(className) {
return document.getElementsByClassName(className).length > 0
@ -71,6 +72,12 @@ export default {
initScrollbar('sidenav')
}
},
async logout() {
const result = await loginAPI.logout(this.$store.state.session_id)
// do we have to check success?
this.$store.dispatch('logout')
this.$router.push('/login')
},
},
mounted() {
this.initScrollbar()

View File

@ -28,6 +28,7 @@
<script>
import { BaseNav } from '@/components'
import VueQrcode from 'vue-qrcode'
import loginAPI from '../../apis/loginAPI'
export default {
components: {