-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpage.tsx
More file actions
25 lines (18 loc) · 743 Bytes
/
page.tsx
File metadata and controls
25 lines (18 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'use server';
import {
PageProps,
validateSubmittedSMSTemplate,
} from 'nhs-notify-web-template-management-utils';
import { getTemplate } from '@utils/form-actions';
import { redirect, RedirectType } from 'next/navigation';
import { ViewSMSTemplate } from '@molecules/ViewSMSTemplate/ViewSMSTemplate';
const ViewSubmittedSMSTemplatePage = async (props: PageProps) => {
const { templateId } = await props.params;
const template = await getTemplate(templateId);
const validatedTemplate = validateSubmittedSMSTemplate(template);
if (!validatedTemplate) {
redirect('/invalid-template', RedirectType.replace);
}
return <ViewSMSTemplate initialState={validatedTemplate} />;
};
export default ViewSubmittedSMSTemplatePage;