Remove refreshToken navigation side effects and let callers handle redirects

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

No files matched your search

+2 -2
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();
});
});
});