Add dedicated local admin domain routing
This commit is contained in:
@@ -4,7 +4,7 @@ import { revalidatePath } from "next/cache";
|
||||
import { redirect } from "next/navigation";
|
||||
import { isRedirectError } from "next/dist/client/components/redirect-error";
|
||||
|
||||
import { toInternalAdminPath } from "@/lib/admin-routing";
|
||||
import { getAdminAppPath, toInternalAdminPath } from "@/lib/admin-routing";
|
||||
import { clearAdminSessionCookie, isAdminAuthenticated } from "@/lib/admin-auth";
|
||||
import { updateMarqueeSettings } from "@/lib/app-config";
|
||||
import { routing } from "@/i18n/routing";
|
||||
@@ -13,7 +13,7 @@ import { getLocalizedPath } from "@/lib/locale";
|
||||
async function ensureAdmin() {
|
||||
if (!(await isAdminAuthenticated())) {
|
||||
await clearAdminSessionCookie();
|
||||
redirect("/");
|
||||
redirect(getAdminAppPath("/"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,13 +72,13 @@ export async function saveMarqueeSettingsAction(formData: FormData) {
|
||||
await updateMarqueeSettings(settings);
|
||||
await revalidateMarqueePages();
|
||||
|
||||
redirect(withMessage("/marquee", "success", "Marquee gespeichert."));
|
||||
redirect(withMessage(getAdminAppPath("/marquee"), "success", "Marquee gespeichert."));
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
const message = error instanceof Error ? error.message : "Marquee konnte nicht gespeichert werden.";
|
||||
redirect(withMessage("/marquee", "error", message));
|
||||
redirect(withMessage(getAdminAppPath("/marquee"), "error", message));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user