fix: login with revalidate path and wrong preferences link (#654)

This commit is contained in:
Meier Lukas
2024-06-10 21:17:51 +02:00
committed by GitHub
parent 2e782ae442
commit 8e4ba37f94
2 changed files with 5 additions and 2 deletions

View File

@@ -12,6 +12,8 @@ import { useScopedI18n } from "@homarr/translation/client";
import type { z } from "@homarr/validation"; import type { z } from "@homarr/validation";
import { validation } from "@homarr/validation"; import { validation } from "@homarr/validation";
import { revalidatePathActionAsync } from "~/app/revalidatePathAction";
export const LoginForm = () => { export const LoginForm = () => {
const t = useScopedI18n("user"); const t = useScopedI18n("user");
const router = useRouter(); const router = useRouter();
@@ -32,7 +34,7 @@ export const LoginForm = () => {
redirect: false, redirect: false,
callbackUrl: "/", callbackUrl: "/",
}) })
.then((response) => { .then(async (response) => {
if (!response?.ok || response.error) { if (!response?.ok || response.error) {
throw response?.error; throw response?.error;
} }
@@ -41,6 +43,7 @@ export const LoginForm = () => {
title: t("action.login.notification.success.title"), title: t("action.login.notification.success.title"),
message: t("action.login.notification.success.message"), message: t("action.login.notification.success.message"),
}); });
await revalidatePathActionAsync("/");
router.push("/"); router.push("/");
}) })
.catch((error: Error | string) => { .catch((error: Error | string) => {

View File

@@ -72,7 +72,7 @@ export const UserAvatarMenu = ({ children }: UserAvatarMenuProps) => {
<> <>
<Menu.Item <Menu.Item
component={Link} component={Link}
href={`/manage/users/${session.data?.user.id}`} href={`/manage/users/${session.data?.user.id}/general`}
leftSection={<IconSettings size="1rem" />} leftSection={<IconSettings size="1rem" />}
> >
{t("preferences")} {t("preferences")}