Fix login redirection

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Jonathan
2025-06-17 16:21:40 +02:00
committed by Bryan Frimin
parent 2962e4b56b
commit 3799db1f45

View File

@@ -1,12 +1,11 @@
import { useTranslate } from "@probo/i18n"; import { useTranslate } from "@probo/i18n";
import { Button, Field, useToast } from "@probo/ui"; import { Button, Field, useToast } from "@probo/ui";
import type { FormEventHandler } from "react"; import type { FormEventHandler } from "react";
import { Link, useNavigate } from "react-router"; import { Link } from "react-router";
import { buildEndpoint, clearRelayStore } from "/providers/RelayProviders"; import { buildEndpoint } from "/providers/RelayProviders";
export default function LoginPage() { export default function LoginPage() {
const { __ } = useTranslate(); const { __ } = useTranslate();
const navigate = useNavigate();
const { toast } = useToast(); const { toast } = useToast();
const handleSubmit: FormEventHandler<HTMLFormElement> = async (e) => { const handleSubmit: FormEventHandler<HTMLFormElement> = async (e) => {
@@ -27,8 +26,7 @@ export default function LoginPage() {
const error = await res.json(); const error = await res.json();
throw new Error(error.message || __("Failed to login")); throw new Error(error.message || __("Failed to login"));
} }
clearRelayStore(); window.location.href = "/";
navigate("/");
}) })
.catch((e) => { .catch((e) => {
toast({ toast({