mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-24 11:10:25 +02:00
fix(auth): preserve last workspace ID across re-login
The logout handler was clearing `multica_workspace_id` from storage, so re-login always defaulted to the first workspace. The workspace ID is a user preference, not session-sensitive data — keep it so both web and desktop restore the correct workspace after re-authentication. Also pass `lastWorkspaceId` in the desktop login page, which was previously missing.
This commit is contained in:
@@ -2,6 +2,8 @@ import { LoginPage } from "@multica/views/auth";
|
||||
import { MulticaIcon } from "@multica/ui/components/common/multica-icon";
|
||||
|
||||
export function DesktopLoginPage() {
|
||||
const lastWorkspaceId = localStorage.getItem("multica_workspace_id");
|
||||
|
||||
return (
|
||||
<div className="flex h-screen flex-col">
|
||||
{/* Traffic light inset */}
|
||||
@@ -11,6 +13,7 @@ export function DesktopLoginPage() {
|
||||
/>
|
||||
<LoginPage
|
||||
logo={<MulticaIcon bordered size="lg" />}
|
||||
lastWorkspaceId={lastWorkspaceId}
|
||||
onSuccess={() => {
|
||||
// Auth store update triggers AppContent re-render → shows DesktopShell
|
||||
}}
|
||||
|
||||
@@ -72,7 +72,6 @@ export function createAuthStore(options: AuthStoreOptions) {
|
||||
|
||||
logout: () => {
|
||||
storage.removeItem("multica_token");
|
||||
storage.removeItem("multica_workspace_id");
|
||||
api.setToken(null);
|
||||
api.setWorkspaceId(null);
|
||||
onLogout?.();
|
||||
|
||||
Reference in New Issue
Block a user