Fixes localization 500 error (#1858)
* fix localization crash * add optional chain on themeTypes object * add comment
This commit is contained in:
parent
105d0dffb0
commit
b2b61c26ef
1 changed files with 25 additions and 17 deletions
|
@ -115,13 +115,18 @@ export const LocalizationTab = ({
|
||||||
|
|
||||||
useFetch(
|
useFetch(
|
||||||
async () => {
|
async () => {
|
||||||
let result = await adminClient.realms.getRealmLocalizationTexts({
|
let result = await adminClient.realms
|
||||||
first,
|
.getRealmLocalizationTexts({
|
||||||
max,
|
first,
|
||||||
realm: realm.realm!,
|
max,
|
||||||
selectedLocale:
|
realm: realm.realm!,
|
||||||
selectMenuLocale || getValues("defaultLocale") || whoAmI.getLocale(),
|
selectedLocale:
|
||||||
});
|
selectMenuLocale ||
|
||||||
|
getValues("defaultLocale") ||
|
||||||
|
whoAmI.getLocale(),
|
||||||
|
})
|
||||||
|
// prevents server error in dev mode due to snowpack
|
||||||
|
.catch(() => []);
|
||||||
|
|
||||||
const searchInBundles = (idx: number) => {
|
const searchInBundles = (idx: number) => {
|
||||||
return Object.entries(result).filter((i) => i[idx].includes(filter));
|
return Object.entries(result).filter((i) => i[idx].includes(filter));
|
||||||
|
@ -405,17 +410,20 @@ export const LocalizationTab = ({
|
||||||
isOpen={supportedLocalesOpen}
|
isOpen={supportedLocalesOpen}
|
||||||
placeholderText={t("selectLocales")}
|
placeholderText={t("selectLocales")}
|
||||||
>
|
>
|
||||||
{themeTypes.login![0].locales.map(
|
{
|
||||||
(locale: string, idx: number) => (
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||||
<SelectOption
|
themeTypes.login![0].locales?.map(
|
||||||
selected={value.includes(locale)}
|
(locale: string, idx: number) => (
|
||||||
key={`locale-${idx}`}
|
<SelectOption
|
||||||
value={locale}
|
selected={value.includes(locale)}
|
||||||
>
|
key={`locale-${idx}`}
|
||||||
{t(`allSupportedLocales.${locale}`)}
|
value={locale}
|
||||||
</SelectOption>
|
>
|
||||||
|
{t(`allSupportedLocales.${locale}`)}
|
||||||
|
</SelectOption>
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)}
|
}
|
||||||
</Select>
|
</Select>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in a new issue