Fix login page routing
This commit is contained in:
@@ -64,7 +64,7 @@ const router = createBrowserRouter([
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/login",
|
path: "/login-prompt",
|
||||||
Component: Login,
|
Component: Login,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export function Login() {
|
|||||||
<CardDescription>Zaloguj się, aby kontynuować</CardDescription>
|
<CardDescription>Zaloguj się, aby kontynuować</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="flex flex-col gap-2 content-stretch max-w-sm">
|
<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ę
|
Zaloguj się
|
||||||
</a>
|
</a>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { client } from "@/client";
|
import { API_URL_PREFIX, client } from "@/client";
|
||||||
import { Button, buttonVariants } from "@/components/ui/button";
|
import { Button, buttonVariants } from "@/components/ui/button";
|
||||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
|
||||||
import { setUser, useStore } from "@/hooks/useStore";
|
import { setUser, useStore } from "@/hooks/useStore";
|
||||||
@@ -19,7 +19,7 @@ export function Root() {
|
|||||||
const data = yield* pipe(
|
const data = yield* pipe(
|
||||||
client.me(),
|
client.me(),
|
||||||
Effect.tapErrorTag("Unauthenticated", () => Effect.sync(() => {
|
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();
|
yield* client.logout();
|
||||||
|
|
||||||
setUser(null);
|
setUser(null);
|
||||||
navigate("/login");
|
navigate("/login-prompt");
|
||||||
}).pipe(Effect.runPromise);
|
}).pipe(Effect.runPromise);
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
|||||||
Reference in New Issue
Block a user