mirror of
https://github.com/chansee97/nova-admin.git
synced 2025-04-23 18:00:19 +08:00
chore(projects): 增加vue,vueRouter的hook自动引入
This commit is contained in:
parent
19bd363ac6
commit
c74023901c
@ -50,7 +50,7 @@ export default class createAxiosInstance {
|
|||||||
switch (code) {
|
switch (code) {
|
||||||
case this.backendConfig.successCode:
|
case this.backendConfig.successCode:
|
||||||
// code === 200 代表没有错误,直接返回约定的数据内容
|
// code === 200 代表没有错误,直接返回约定的数据内容
|
||||||
return apiData[this.backendConfig.dataKey];
|
return apiData;
|
||||||
default:
|
default:
|
||||||
// 不是正确的 Code,返回错误提示信息
|
// 不是正确的 Code,返回错误提示信息
|
||||||
return Promise.reject(new Error(`Error:${this.backendConfig.dataKey}`));
|
return Promise.reject(new Error(`Error:${this.backendConfig.dataKey}`));
|
||||||
|
@ -21,10 +21,10 @@ export const useAuthStore = defineStore('auth-store', {
|
|||||||
/* 用户登录 */
|
/* 用户登录 */
|
||||||
async login(userName: string, password: string) {
|
async login(userName: string, password: string) {
|
||||||
this.loginLoading = true;
|
this.loginLoading = true;
|
||||||
const data = await fetchLogin({ userName, password });
|
const { data } = await fetchLogin({ userName, password });
|
||||||
|
|
||||||
// 处理登录信息
|
// 处理登录信息
|
||||||
this.handleAfterLogin(data as any);
|
await this.handleAfterLogin(data as any);
|
||||||
|
|
||||||
this.loginLoading = false;
|
this.loginLoading = false;
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user