mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-16 14:49:09 +02:00
AuthStore.initialize() cleared the stored token on any error from `api.getMe()`, which meant a transient failure — backend rolling restart, network blip, HMR-aborted fetch in local dev — would force a re-login. On 401 the token is already cleared upstream via ApiClient.onUnauthorized, so the store's catch block only needs to reset the in-memory user state. Check `err instanceof ApiError && err.status === 401` before clearing workspace context; leave the token in storage for every other error so the next initialize() can retry. Adds regression tests covering the 401 / 500 / network-failure / happy paths.