Fix login page routing

This commit is contained in:
2025-10-08 01:03:30 +02:00
parent 21f7b55c8a
commit cd5eb280cc
3 changed files with 5 additions and 5 deletions

View File

@@ -64,7 +64,7 @@ const router = createBrowserRouter([
],
},
{
path: "/login",
path: "/login-prompt",
Component: Login,
},
]);

View File

@@ -11,7 +11,7 @@ export function Login() {
<CardDescription>Zaloguj się, aby kontynuować</CardDescription>
</CardHeader>
<CardContent className="flex flex-col gap-2 content-stretch max-w-sm">
<a className={buttonVariants()} href={`${API_URL_PREFIX}/login`}>
<a className={buttonVariants()} href={`${API_URL_PREFIX ?? location.origin}/login`}>
Zaloguj się
</a>
</CardContent>

View File

@@ -1,4 +1,4 @@
import { client } from "@/client";
import { API_URL_PREFIX, client } from "@/client";
import { Button, buttonVariants } from "@/components/ui/button";
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
import { setUser, useStore } from "@/hooks/useStore";
@@ -19,7 +19,7 @@ export function Root() {
const data = yield* pipe(
client.me(),
Effect.tapErrorTag("Unauthenticated", () => Effect.sync(() => {
navigate("/login");
location.href = `${API_URL_PREFIX ?? location.origin}/login`;
})),
);
@@ -30,7 +30,7 @@ export function Root() {
yield* client.logout();
setUser(null);
navigate("/login");
navigate("/login-prompt");
}).pipe(Effect.runPromise);
// eslint-disable-next-line react-hooks/exhaustive-deps