mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 12:03:17 +00:00
fix server action response
This commit is contained in:
@@ -54,7 +54,7 @@ export default async function RootLayout({
|
||||
<GlobalNav />
|
||||
) : (
|
||||
<div className="absolute bottom-0 right-0 flex flex-row p-4 items-center space-x-4">
|
||||
{locale && <LanguageSwitcher locale={locale} />}
|
||||
<LanguageSwitcher />
|
||||
<Theme />
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
Transition,
|
||||
} from "@headlessui/react";
|
||||
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/react/24/outline";
|
||||
import { useLocale } from "next-intl";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { Fragment, useState } from "react";
|
||||
|
||||
@@ -40,12 +41,8 @@ const LANGS: Lang[] = [
|
||||
},
|
||||
];
|
||||
|
||||
type Props = {
|
||||
locale: string;
|
||||
};
|
||||
|
||||
export function LanguageSwitcher({ locale }: Props) {
|
||||
const currentLocale = locale || "en";
|
||||
export function LanguageSwitcher() {
|
||||
const currentLocale = useLocale();
|
||||
|
||||
const [selected, setSelected] = useState(
|
||||
LANGS.find((l) => l.code === currentLocale) || LANGS[0],
|
||||
@@ -83,7 +80,7 @@ export function LanguageSwitcher({ locale }: Props) {
|
||||
>
|
||||
<ListboxOptions
|
||||
anchor="bottom"
|
||||
className="absolute mt-1 max-h-60 w-[var(--button-width)] w-full overflow-auto rounded-md text-text-light-500 dark:text-text-dark-500 bg-background-light-500 dark:bg-background-dark-500 py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none sm:text-sm"
|
||||
className="absolute mt-1 max-h-60 w-52 w-full overflow-auto rounded-md text-text-light-500 dark:text-text-dark-500 bg-background-light-500 dark:bg-background-dark-500 py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none sm:text-sm"
|
||||
>
|
||||
{LANGS.map((lang, index) => (
|
||||
<ListboxOption
|
||||
|
||||
@@ -28,8 +28,8 @@ function setSessionHttpOnlyCookie<T>(sessions: SessionCookie<T>[]) {
|
||||
|
||||
export async function setLanguageCookie(language: string) {
|
||||
const cookiesList = cookies();
|
||||
// @ts-ignore
|
||||
return cookiesList.set({
|
||||
|
||||
await cookiesList.set({
|
||||
name: "NEXT_LOCALE",
|
||||
value: language,
|
||||
httpOnly: true,
|
||||
|
||||
Reference in New Issue
Block a user