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 { isCheckedFormValue } from "@/lib/form-data";
|
||||
import {
|
||||
@@ -16,7 +16,7 @@ import type { ContactProtectionSettings } from "@/lib/contact-protection";
|
||||
async function ensureAdmin() {
|
||||
if (!(await isAdminAuthenticated())) {
|
||||
await clearAdminSessionCookie();
|
||||
redirect("/");
|
||||
redirect(getAdminAppPath("/"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ export async function saveContactProtectionSettingsAction(formData: FormData) {
|
||||
revalidatePath("/en/contact");
|
||||
redirect(
|
||||
withMessage(
|
||||
"/smtp/contact-protection",
|
||||
getAdminAppPath("/smtp/contact-protection"),
|
||||
"success",
|
||||
"Contact Protection gespeichert.",
|
||||
),
|
||||
@@ -107,6 +107,6 @@ export async function saveContactProtectionSettingsAction(formData: FormData) {
|
||||
? error.message
|
||||
: "Contact Protection konnte nicht gespeichert werden.";
|
||||
|
||||
redirect(withMessage("/smtp/contact-protection", "error", message));
|
||||
redirect(withMessage(getAdminAppPath("/smtp/contact-protection"), "error", message));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user