feat: citizenship applications
This commit is contained in:
@@ -5,6 +5,7 @@ import { Block, PageMeta, PageStatus, PageType } from "./types";
|
||||
import { archivePage, createPage, deletePage, updatePage } from "./repository";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { deleteNavLinkByPageId } from "../navlinks/repository";
|
||||
import { validatePage } from "./validation";
|
||||
|
||||
export async function savePageAction(params: {
|
||||
id: string | null,
|
||||
@@ -15,6 +16,10 @@ export async function savePageAction(params: {
|
||||
blocks: Block[],
|
||||
meta?: PageMeta
|
||||
}) {
|
||||
const parsed = validatePage(params);
|
||||
if (!parsed.success) {
|
||||
throw new Error(parsed.errors.join("; "));
|
||||
}
|
||||
|
||||
if (params.id) {
|
||||
await updatePage(params.id, params.title, params.type, params.status, params.blocks, params.meta);
|
||||
|
||||
Reference in New Issue
Block a user