Fix login page routing
This commit is contained in:
@@ -64,7 +64,7 @@ const router = createBrowserRouter([
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/login",
|
||||
path: "/login-prompt",
|
||||
Component: Login,
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user