ソースを参照

logout

master
chutingting 1年前
コミット
ad3df75f03
2個のファイルの変更8行の追加4行の削除
  1. +2
    -2
      src/api/user.js
  2. +6
    -2
      src/layout/components/Navbar.vue

+ 2
- 2
src/api/user.js ファイルの表示

@@ -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 ファイルの表示

@@ -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`)
})
}
}
}


読み込み中…
キャンセル
保存