From 8e4ba37f94294577926ae6e668d50b2e151b2d35 Mon Sep 17 00:00:00 2001 From: Meier Lukas Date: Mon, 10 Jun 2024 21:17:51 +0200 Subject: [PATCH] fix: login with revalidate path and wrong preferences link (#654) --- apps/nextjs/src/app/[locale]/auth/login/_login-form.tsx | 5 ++++- apps/nextjs/src/components/user-avatar-menu.tsx | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/nextjs/src/app/[locale]/auth/login/_login-form.tsx b/apps/nextjs/src/app/[locale]/auth/login/_login-form.tsx index d0345ec72..555862a51 100644 --- a/apps/nextjs/src/app/[locale]/auth/login/_login-form.tsx +++ b/apps/nextjs/src/app/[locale]/auth/login/_login-form.tsx @@ -12,6 +12,8 @@ import { useScopedI18n } from "@homarr/translation/client"; import type { z } from "@homarr/validation"; import { validation } from "@homarr/validation"; +import { revalidatePathActionAsync } from "~/app/revalidatePathAction"; + export const LoginForm = () => { const t = useScopedI18n("user"); const router = useRouter(); @@ -32,7 +34,7 @@ export const LoginForm = () => { redirect: false, callbackUrl: "/", }) - .then((response) => { + .then(async (response) => { if (!response?.ok || response.error) { throw response?.error; } @@ -41,6 +43,7 @@ export const LoginForm = () => { title: t("action.login.notification.success.title"), message: t("action.login.notification.success.message"), }); + await revalidatePathActionAsync("/"); router.push("/"); }) .catch((error: Error | string) => { diff --git a/apps/nextjs/src/components/user-avatar-menu.tsx b/apps/nextjs/src/components/user-avatar-menu.tsx index 0cd5e0726..f8be743e6 100644 --- a/apps/nextjs/src/components/user-avatar-menu.tsx +++ b/apps/nextjs/src/components/user-avatar-menu.tsx @@ -72,7 +72,7 @@ export const UserAvatarMenu = ({ children }: UserAvatarMenuProps) => { <> } > {t("preferences")}