Selaa lähdekoodia

logout

master
chutingting 1 vuosi sitten
vanhempi
commit
ad3df75f03
2 muutettua tiedostoa jossa 8 lisäystä ja 4 poistoa
  1. +2
    -2
      src/api/user.js
  2. +6
    -2
      src/layout/components/Navbar.vue

+ 2
- 2
src/api/user.js Näytä tiedosto

@@ -18,7 +18,7 @@ export function getInfo(token) {

export function logout() {
return request({
url: '/vue-admin-template/user/logout',
method: 'post'
url: '/logout',
method: 'get'
})
}

+ 6
- 2
src/layout/components/Navbar.vue Näytä tiedosto

@@ -36,6 +36,9 @@ import { mapGetters } from 'vuex'
import Breadcrumb from '@/components/Breadcrumb'
import Hamburger from '@/components/Hamburger'

import {
logoutApi
} from '@/api/login'
export default {
components: {
Breadcrumb,
@@ -52,8 +55,9 @@ export default {
this.$store.dispatch('app/toggleSideBar')
},
async logout() {
// await this.$store.dispatch('user/logout')
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
logoutApi().then(res => {
this.$router.push(`/login`)
})
}
}
}


Ladataan…
Peruuta
Tallenna