fix(chat): redirect unauthenticated users from chat

This commit is contained in:
2026-06-17 19:44:22 +08:00
parent bb40f3c042
commit e4b1690b45
4 changed files with 47 additions and 22 deletions
+4
View File
@@ -34,6 +34,8 @@ interface AuthState {
errorMessage: string | null;
/** 当前登录状态(未登录 / 游客 / OAuth / 邮箱) */
loginStatus: MachineContext["loginStatus"];
/** 启动时的本地登录态恢复是否已经完成 */
hasInitialized: MachineContext["hasInitialized"];
/**
* 一次性的"刚按了"信号 —— Skip / Facebook / 邮箱登录按钮派完业务事件后置 true,
* splash-screen / auth-screen 看到 `pendingRedirect && loginStatus !== "notLoggedIn"`
@@ -67,12 +69,14 @@ export function AuthProvider({ children }: AuthProviderProps) {
state.matches("loadingEmailLogin") ||
state.matches("loadingEmailRegister") ||
state.matches("loadingOAuth") ||
state.matches("initializing") ||
state.matches("loggingOut") ||
state.matches("syncingGoogleBackend") ||
state.matches("syncingFacebookBackend") ||
state.matches("loadingGuestLogin"),
errorMessage: state.context.errorMessage,
loginStatus: state.context.loginStatus,
hasInitialized: state.context.hasInitialized,
pendingRedirect: state.context.pendingRedirect,
}),
[state],