Remove refreshToken navigation side effects and let callers handle redirects

Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
2026-03-08 19:32:06 +08:00
parent 1670054356
commit 28464214bc
2 changed files with 2 additions and 3 deletions

View File

@@ -261,13 +261,13 @@ describe("loginStore", () => {
cookieSetter.mockRestore();
});
it("redirects to login and re-throws on failure", async () => {
it("re-throws on failure without performing navigation", async () => {
document.cookie = "luciaRefreshToken=old-refresh-token";
axios.post.mockRejectedValue(new Error("401"));
await expect(store.refreshToken()).rejects.toThrow("401");
expect(store.$router.push).toHaveBeenCalledWith("/login");
expect(store.$router.push).not.toHaveBeenCalled();
});
});
});