Fix real Biome bugs: inner declarations, dup keys, assign-in-expr, implicit any, cookie, a11y svg/keyboard, json
Local Build and Deploy / deploy (push) Successful in 51s
Local Build and Deploy / deploy (push) Successful in 51s
This commit is contained in:
1 parent
8d5c8ec96f
commit
59b63d6e70
19 files changed
+76
-44
No files matched your search
@@ -5,6 +5,7 @@ import Image from "next/image";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useLocale } from "next-intl";
|
||||
import { useEffect, useMemo, useRef, useState, useTransition } from "react";
|
||||
import { setLocaleCookie } from "@/actions/set-locale";
|
||||
|
||||
const LOCALES: { code: string; label: string; lang: string }[] = [
|
||||
{ code: "nl", label: "Nederlands", lang: "nl" },
|
||||
@@ -66,8 +67,10 @@ export function LanguageSwitcher() {
|
||||
|
||||
function switchLocale(code: string) {
|
||||
if (code === locale) return;
|
||||
document.cookie = `NEXT_LOCALE=${code};path=/;max-age=31536000;samesite=strict;secure`;
|
||||
startTransition(() => router.refresh());
|
||||
startTransition(async () => {
|
||||
await setLocaleCookie(code);
|
||||
router.refresh();
|
||||
});
|
||||
setOpen(false);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user