@@ -13,9 +13,7 @@ export function loginByUsername({ loginName, password, code }) {
}
export function logout() {
- return httpApp.post({
- url: "/login/logout",
- });
+ return httpApp.post("/api/admin/user/logout");
export function getLogo(code) {
@@ -71,6 +71,8 @@ declare module "vue/types/vue" {
interface Vue {
$http: AxiosInstance;
// $api: api;
+ /** @param cause "?cause=正常退出" */
+ logout(cause?: string): Promise;
@@ -1,12 +1,15 @@
import { removeToken } from "@/auth/auth";
+import { logout } from "@/api/login";
import Vue from "vue";
Vue.mixin({
methods: {
logout(cause = "") {
- removeToken();
// window._hmt.push(["_trackEvent", "退出", cause]);
- this.$router.push("/login" + cause);
+ return logout().finally(() => {
+ removeToken();
+ this.$router.push("/login" + cause);
+ });
},
});
@@ -124,7 +124,7 @@ export default {
if (!result) return;
- this.$router.push("/login");
+ this.logout("?cause=点击退出");
checkDocIsFullscreen() {
return (