|
@@ -1,5 +1,5 @@
|
|
|
import type { UserInfo, LoginInfo } from '/#/store';
|
|
|
-import type { ErrorMessageMode } from '/#/axios';
|
|
|
+import type { ErrorMessageMode, SuccessMessageMode } from '/#/axios';
|
|
|
import { defineStore } from 'pinia';
|
|
|
import { store } from '/@/store';
|
|
|
import { PageEnum } from '/@/enums/pageEnum';
|
|
@@ -141,11 +141,12 @@ export const useUserStore = defineStore({
|
|
|
params: LoginParams & {
|
|
|
goHome?: boolean;
|
|
|
mode?: ErrorMessageMode;
|
|
|
+ successMode?: SuccessMessageMode;
|
|
|
}
|
|
|
): Promise<GetUserInfoModel | null> {
|
|
|
try {
|
|
|
- const { goHome = true, mode, ...loginParams } = params;
|
|
|
- const data = await loginApi(loginParams, mode);
|
|
|
+ const { goHome = true, mode, successMode, ...loginParams } = params;
|
|
|
+ const data = await loginApi(loginParams, mode, successMode);
|
|
|
const { token, userInfo } = data;
|
|
|
// save token
|
|
|
this.setToken(token);
|
|
@@ -369,6 +370,7 @@ export const useUserStore = defineStore({
|
|
|
params: Partial<LoginParams> & {
|
|
|
goHome?: boolean;
|
|
|
mode?: ErrorMessageMode;
|
|
|
+ successMode?: SuccessMessageMode;
|
|
|
} = {}
|
|
|
) {
|
|
|
try {
|
|
@@ -376,6 +378,7 @@ export const useUserStore = defineStore({
|
|
|
username: MOCK_LOGIN_UESRNAME,
|
|
|
password: MOCK_LOGIN_PASSWORD,
|
|
|
checkKey: new Date().getTime(),
|
|
|
+ successMode: 'none' as SuccessMessageMode,
|
|
|
...params,
|
|
|
};
|
|
|
return this.login(loginParams);
|
|
@@ -388,6 +391,7 @@ export const useUserStore = defineStore({
|
|
|
params: Partial<LoginParams> & {
|
|
|
goHome?: boolean;
|
|
|
mode?: ErrorMessageMode;
|
|
|
+ successMode?: SuccessMessageMode;
|
|
|
} = {}
|
|
|
) {
|
|
|
await this.logout();
|
|
@@ -402,10 +406,11 @@ export const useUserStore = defineStore({
|
|
|
params: AutoLoginParams & {
|
|
|
goHome?: boolean;
|
|
|
mode?: ErrorMessageMode;
|
|
|
+ successMode?: SuccessMessageMode;
|
|
|
}
|
|
|
) {
|
|
|
- const { goHome = true, mode, ...loginParams } = params;
|
|
|
- const data = await autoLoginApi(loginParams, mode);
|
|
|
+ const { goHome = true, mode, successMode = 'none', ...loginParams } = params;
|
|
|
+ const data = await autoLoginApi(loginParams, mode, successMode);
|
|
|
const { token, userInfo } = data;
|
|
|
// save token
|
|
|
this.setToken(token);
|