mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-11-18 07:22:06 +00:00
auto apply oxfmt rules
This commit is contained in:
@@ -30,23 +30,14 @@ export const LocaleChecker = ({ children }: LocaleCheckerProps) => {
|
||||
|
||||
// If the user is authenticated and has a preferred locale that is different from the user's locale,
|
||||
// then we update redirect to the user's preference
|
||||
if (
|
||||
status === "authenticated" &&
|
||||
userLocale !== undefined &&
|
||||
userLocale !== locale
|
||||
) {
|
||||
if (status === "authenticated" && userLocale !== undefined && userLocale !== locale) {
|
||||
router.push({ pathname, params: params as any }, { locale: userLocale });
|
||||
}
|
||||
}, [locale, sessionData, status, params, pathname, router, userLocale]);
|
||||
|
||||
// To avoid flickering, we don't render the children until we have the user's locale
|
||||
if (status === "loading") return null;
|
||||
if (
|
||||
status === "authenticated" &&
|
||||
userLocale !== undefined &&
|
||||
userLocale !== locale
|
||||
)
|
||||
return null;
|
||||
if (status === "authenticated" && userLocale !== undefined && userLocale !== locale) return null;
|
||||
|
||||
return children;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user