系统设置:接入完成

This commit is contained in:
YunaiV
2023-12-16 21:40:34 +08:00
parent d63bbf9dc3
commit d95786154c
3 changed files with 40 additions and 22 deletions
+14
View File
@@ -0,0 +1,14 @@
import request2 from '@/sheep/request2';
const AuthUtil = {
// 登出系统
logout: () => {
return request2({
url: '/app-api/member/auth/logout',
method: 'POST'
});
},
};
export default AuthUtil;
+4 -5
View File
@@ -14,6 +14,7 @@ import app from './app';
import {
showAuthModal
} from '@/sheep/hooks/useModal';
import AuthUtil from '@/sheep/api/member/auth';
// 默认用户信息
const defaultUserInfo = {
@@ -58,7 +59,7 @@ const user = defineStore({
} = await userApi.profile();
// 为了兼容 获取用户余额 可能还会用到其他参数
// 优惠券数量,积分数量 应该在这里
// 优惠券数量,积分数量 应该在这里
const {
code: code2,
data: data2
@@ -169,10 +170,8 @@ const user = defineStore({
// 登出
async logout(force = false) {
if (!force) {
const {
error
} = await userApi.logout();
if (error === 0) {
const { code } = AuthUtil.logout();
if (code === 0) {
this.resetUserData();
}
}