Move admin area to root subdomain
CI / quality (push) Waiting to run

This commit is contained in:
MOH
2026-03-12 00:15:12 +01:00
parent e7dab6f0ef
commit 87a597c872
50 changed files with 256 additions and 140 deletions
+6 -5
View File
@@ -4,6 +4,7 @@ import { revalidatePath } from "next/cache";
import { redirect } from "next/navigation";
import { isRedirectError } from "next/dist/client/components/redirect";
import { toInternalAdminPath } from "@/lib/admin-routing";
import { clearAdminSessionCookie, isAdminAuthenticated } from "@/lib/admin-auth";
import { updateMarqueeSettings } from "@/lib/app-config";
import { routing } from "@/i18n/routing";
@@ -12,7 +13,7 @@ import { getLocalizedPath } from "@/lib/locale";
function ensureAdmin() {
if (!isAdminAuthenticated()) {
clearAdminSessionCookie();
redirect("/root");
redirect("/");
}
}
@@ -24,8 +25,8 @@ function withMessage(pathname: string, type: "success" | "error", message: strin
}
async function revalidateMarqueePages() {
revalidatePath("/root");
revalidatePath("/root/marquee");
revalidatePath(toInternalAdminPath("/"));
revalidatePath(toInternalAdminPath("/marquee"));
for (const locale of routing.locales) {
revalidatePath(getLocalizedPath(locale), "layout");
@@ -71,13 +72,13 @@ export async function saveMarqueeSettingsAction(formData: FormData) {
await updateMarqueeSettings(settings);
await revalidateMarqueePages();
redirect(withMessage("/root/marquee", "success", "Marquee gespeichert."));
redirect(withMessage("/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("/root/marquee", "error", message));
redirect(withMessage("/marquee", "error", message));
}
}
+2 -2
View File
@@ -27,14 +27,14 @@ const copy = {
export default async function RootMarqueePage() {
if (!isAdminAuthenticated()) {
redirect("/root");
redirect("/");
}
async function logoutAction() {
"use server";
clearAdminSessionCookie();
redirect("/root");
redirect("/");
}
const marqueeSettings = await getMarqueeSettings();