Skip to content

Commit

Permalink
lager en const for dekorator-språk-cookie-navn
Browse files Browse the repository at this point in the history
  • Loading branch information
toresbe committed Nov 20, 2024
1 parent 858e1b8 commit 4583f50
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/i18n/routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import {defineRouting} from "next-intl/routing";
import {createNavigation} from "next-intl/navigation";
import type {NextResponse} from "next/server";
import {DEFAULT_LANGUAGE as defaultLocale, SUPPORTED_LANGUAGES as locales} from "../lib/i18n/common";
import {DECORATOR_LANG_COOKIE} from "../lib/constants.ts";
// Kopiert fra node_modules/next-intl/dist/types/src/routing/config.d.ts
type CookieAttributes = Pick<
NonNullable<Parameters<typeof NextResponse.prototype.cookies.set>["2"]>,
"maxAge" | "domain" | "partitioned" | "path" | "priority" | "sameSite" | "secure" | "name"
>;

const localeCookie: CookieAttributes = {name: "decorator-language", path: "/"};
const localeCookie: CookieAttributes = {name: DECORATOR_LANG_COOKIE, path: "/"};

export const routing = defineRouting({locales, defaultLocale, localeCookie, localePrefix: "as-needed"});

Expand Down
2 changes: 1 addition & 1 deletion src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
export const BASE_PATH = "/sosialhjelp/soknad" as const;
export const LINK_PAGE_PATH = `${BASE_PATH}/link` as const;
export const ENABLE_DEBUG_I18N = false;
export const DIGISOS_LANGUAGE_STORAGE_KEY = "digisos-language" as const;
export const DECORATOR_LANG_COOKIE = "decorator-language" as const;
export const XSRF_COOKIE_NAME = "XSRF-TOKEN-SOKNAD-API" as const;
export const XSRF_HEADER_NAME = "X-XSRF-TOKEN" as const;

0 comments on commit 4583f50

Please sign in to comment.