Files
store_ai_front/src/app/(auth)/login/login-error.ts
2026-05-07 17:36:42 +08:00

38 lines
1.1 KiB
TypeScript

export type LoginErrorType = "1" | "2" | "3";
export interface LoginNotice {
tone: "warning" | "success";
title: string;
body: string;
}
const login_error_text: Record<LoginErrorType, LoginNotice> = {
"1": {
tone: "warning",
title: "Signed out from the extension.",
body: "Log back in to continue scanning.",
},
"2": {
tone: "warning",
title: "Signed in on another device.",
body:
"StoreAI allows one active session per account, so this device was signed out. Log back in to continue here - the other device will then be signed out.",
},
"3": {
tone: "success",
title: "An account already exists with this email.",
body: "Sign in below to continue.",
},
};
/**
* 根据 query 中的 error_type 获取登录页提示配置。
*/
export function getLoginNotice(errorType: string | null): LoginNotice | null {
if (!errorType) return null;
if (errorType in login_error_text) {
return login_error_text[errorType as LoginErrorType];
}
return null;
}