@@ -2,7 +2,7 @@
|
||||
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { redirect } from "next/navigation";
|
||||
import { isRedirectError } from "next/dist/client/components/redirect";
|
||||
import { isRedirectError } from "next/dist/client/components/redirect-error";
|
||||
|
||||
import { toInternalAdminPath } from "@/lib/admin-routing";
|
||||
import { clearAdminSessionCookie, isAdminAuthenticated } from "@/lib/admin-auth";
|
||||
@@ -14,9 +14,9 @@ import {
|
||||
import { sendTestEmail } from "@/lib/mail";
|
||||
import type { MailSettings } from "@/lib/mail-settings";
|
||||
|
||||
function ensureAdmin() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
clearAdminSessionCookie();
|
||||
async function ensureAdmin() {
|
||||
if (!(await isAdminAuthenticated())) {
|
||||
await clearAdminSessionCookie();
|
||||
redirect("/");
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ function parseMailSettingsFormData(
|
||||
}
|
||||
|
||||
export async function saveMailSettingsAction(formData: FormData) {
|
||||
ensureAdmin();
|
||||
await ensureAdmin();
|
||||
|
||||
try {
|
||||
const existingMailSettings = await getMailSettings();
|
||||
@@ -95,7 +95,7 @@ export async function saveMailSettingsAction(formData: FormData) {
|
||||
}
|
||||
|
||||
export async function sendTestEmailAction() {
|
||||
ensureAdmin();
|
||||
await ensureAdmin();
|
||||
|
||||
try {
|
||||
await sendTestEmail();
|
||||
|
||||
Reference in New Issue
Block a user