Files
cozsweet-frontend-nextjs/src/models/auth/login-status.ts
T
admin 200fb1642f fix(auth): surface validation errors in email login/register forms
Validation failure was previously silent — the form's submit() returned
without dispatching or showing anything on screen, so users could not tell
why the login/register button appeared to do nothing.

Changes:
- Add validationError local state in EmailLoginForm and EmailRegisterForm
- Display first validation error via AuthErrorMessage, prioritised over
  the server's globalError (validation errors feel more immediate)
- Clear validation error on field change (standard "error fades as you
  fix it" UX) — implemented as onChange handlers, not useEffect, to
  avoid React's cascading-render anti-pattern
- Add observability to the entire email flow (was previously silent end
  to end): form submit ENTRY, validator rejection, actor ENTRY, actor
  DONE — mirrors the logging style already used by guestLoginActor
- Add entry: assign({ errorMessage: null }) to loadingEmailLogin and
  loadingEmailRegister so stale errors clear on transition into the
  loading state (matches loadingGuestLogin)
2026-06-16 17:29:58 +08:00

20 lines
449 B
TypeScript

/**
* 登录状态枚举
*/
export const LoginStatus = {
/** 未登录(默认初值) */
NotLoggedIn: "notLoggedIn",
/** 游客登录 */
Guest: "guest",
/** Facebook OAuth 登录 */
Facebook: "facebook",
/** Google OAuth 登录 */
Google: "google",
/** 邮箱 + 密码登录 */
Email: "email",
/** Apple ID 登录 */
Apple: "apple",
} as const;
export type LoginStatus = (typeof LoginStatus)[keyof typeof LoginStatus];