@@ -282,10 +282,6 @@ export async function saveSiteLocalizationSettingsAction(formData: FormData) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const requestedDefaultLocale = String(formData.get("defaultLocale") ?? "");
|
const requestedDefaultLocale = String(formData.get("defaultLocale") ?? "");
|
||||||
console.info("saveSiteLocalizationSettingsAction:received", {
|
|
||||||
requestedDefaultLocale,
|
|
||||||
});
|
|
||||||
|
|
||||||
const currentSettings = await getSiteSettings();
|
const currentSettings = await getSiteSettings();
|
||||||
const parsedSettings: SiteSettings = {
|
const parsedSettings: SiteSettings = {
|
||||||
...currentSettings,
|
...currentSettings,
|
||||||
@@ -312,11 +308,6 @@ export async function saveSiteLocalizationSettingsAction(formData: FormData) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
console.info("saveSiteLocalizationSettingsAction:parsed", {
|
|
||||||
requestedDefaultLocale,
|
|
||||||
normalizedDefaultLocale: parsedSettings.defaultLocale,
|
|
||||||
});
|
|
||||||
|
|
||||||
for (const locale of routing.locales) {
|
for (const locale of routing.locales) {
|
||||||
if (!parsedSettings.locales[locale].siteName) {
|
if (!parsedSettings.locales[locale].siteName) {
|
||||||
throw new Error(`Site Name fuer ${locale} ist erforderlich.`);
|
throw new Error(`Site Name fuer ${locale} ist erforderlich.`);
|
||||||
@@ -331,9 +322,6 @@ export async function saveSiteLocalizationSettingsAction(formData: FormData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await updateSiteSettings(parsedSettings);
|
await updateSiteSettings(parsedSettings);
|
||||||
console.info("saveSiteLocalizationSettingsAction:updated", {
|
|
||||||
defaultLocale: parsedSettings.defaultLocale,
|
|
||||||
});
|
|
||||||
await revalidateSiteSettingsPages(parsedSettings.defaultLocale);
|
await revalidateSiteSettingsPages(parsedSettings.defaultLocale);
|
||||||
redirect(withMessage(getAdminAppPath("/site-settings/localization"), "success", "Einstellungen gespeichert."));
|
redirect(withMessage(getAdminAppPath("/site-settings/localization"), "success", "Einstellungen gespeichert."));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -341,8 +329,6 @@ export async function saveSiteLocalizationSettingsAction(formData: FormData) {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.error("saveSiteLocalizationSettingsAction:failed", error);
|
|
||||||
|
|
||||||
const message =
|
const message =
|
||||||
error instanceof Error
|
error instanceof Error
|
||||||
? error.message
|
? error.message
|
||||||
|
|||||||
@@ -10,11 +10,6 @@ export async function GET() {
|
|||||||
getMaintenanceMode(),
|
getMaintenanceMode(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
console.info("api:site:default-locale", {
|
|
||||||
defaultLocale: settings.defaultLocale,
|
|
||||||
maintenanceEnabled,
|
|
||||||
});
|
|
||||||
|
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
defaultLocale: settings.defaultLocale,
|
defaultLocale: settings.defaultLocale,
|
||||||
|
|||||||
+1
-12
@@ -63,10 +63,6 @@ async function getSiteRuntimeState(request: NextRequest): Promise<SiteRuntimeSta
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.warn("middleware:getSiteRuntimeState:non-ok", {
|
|
||||||
url: runtimeStateUrl.toString(),
|
|
||||||
status: response.status,
|
|
||||||
});
|
|
||||||
return {
|
return {
|
||||||
defaultLocale: FALLBACK_LOCALE,
|
defaultLocale: FALLBACK_LOCALE,
|
||||||
maintenanceEnabled: false,
|
maintenanceEnabled: false,
|
||||||
@@ -78,18 +74,11 @@ async function getSiteRuntimeState(request: NextRequest): Promise<SiteRuntimeSta
|
|||||||
maintenanceEnabled?: boolean;
|
maintenanceEnabled?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
console.info("middleware:getSiteRuntimeState:resolved", {
|
|
||||||
url: runtimeStateUrl.toString(),
|
|
||||||
defaultLocale: data.defaultLocale,
|
|
||||||
maintenanceEnabled: data.maintenanceEnabled,
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
defaultLocale: isSupportedLocale(data.defaultLocale) ? data.defaultLocale : FALLBACK_LOCALE,
|
defaultLocale: isSupportedLocale(data.defaultLocale) ? data.defaultLocale : FALLBACK_LOCALE,
|
||||||
maintenanceEnabled: data.maintenanceEnabled === true,
|
maintenanceEnabled: data.maintenanceEnabled === true,
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch {
|
||||||
console.error("middleware:getSiteRuntimeState:failed", error);
|
|
||||||
return {
|
return {
|
||||||
defaultLocale: FALLBACK_LOCALE,
|
defaultLocale: FALLBACK_LOCALE,
|
||||||
maintenanceEnabled: false,
|
maintenanceEnabled: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user