Skip to content

Commit

Permalink
revert auto login due to issues when sse error occur (#761)
Browse files Browse the repository at this point in the history
  • Loading branch information
cstenglein authored Jul 31, 2024
1 parent d8fd5ed commit d3ae66a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 4 additions & 6 deletions src/hooks/use-sse.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AppContext } from "@/context/app-context";
import { SSEContext, SSE_URL } from "@/context/sse-context";
import { SSE_URL, SSEContext } from "@/context/sse-context";
import { AppStatus } from "@/models/app-status";
import { App } from "@/models/app.model";
import { BtcInfo } from "@/models/btc-info";
Expand Down Expand Up @@ -98,8 +98,7 @@ function useSSE() {
const t = JSON.parse(event.data);
sseCtx.setTransactions((prev) => {
// add the newest transaction to the beginning
const current = [t, ...prev];
return current;
return [t, ...prev];
});
};

Expand Down Expand Up @@ -198,9 +197,8 @@ function useSSE() {
});
};

const eventErrorHandler = (event: Event) => {
// inform the user about the error
toast.error("An SSE error occurred", { toastId: "sse-error" });
const eventErrorHandler = (_event: Event) => {
appCtx.logout();
};

if (evtSource) {
Expand Down
6 changes: 4 additions & 2 deletions tests/home.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ test("should route to home and save token after login", async ({
).toMatch("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9");
});

test("should login automatically if token is not expired", async ({
// see https://github.com/raspiblitz/raspiblitz-web/issues/760
test.skip("should login automatically if token is not expired", async ({
loginPage,
page,
}) => {
Expand All @@ -66,7 +67,8 @@ test("should login automatically if token is not expired", async ({
await expect(page.getByRole("link", { name: "Home" })).toBeVisible();
});

test("redirect to home if token is not expired & login page was called", async ({
// see https://github.com/raspiblitz/raspiblitz-web/issues/760
test.skip("redirect to home if token is not expired & login page was called", async ({
loginPage,
page,
}) => {
Expand Down

0 comments on commit d3ae66a

Please sign in to comment.