Skip to content

Commit

Permalink
feat(delete-account): set up route skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
coldlink committed Aug 1, 2023
1 parent 212f238 commit 299559e
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/client/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,16 @@ const routes: Array<{
<EmailSentPage formTrackingName="consent-resend" showHelp={true} />
),
},
{
path: '/delete',
// TODO
element: <MaintenancePage />,
},
{
path: '/delete/complete',
// TODO
element: <MaintenancePage />,
},
];

interface Props {
Expand Down
25 changes: 25 additions & 0 deletions src/server/routes/delete.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Request } from 'express';
import { ResponseWithRequestState } from '@/server/models/Express';
import { rateLimitedTypedRouter as router } from '@/server/lib/typedRoutes';
import { renderer } from '@/server/lib/renderer';

router.get('/delete', (req: Request, res: ResponseWithRequestState) => {
const html = renderer('/delete', {
requestState: res.locals,
pageTitle: 'Account Deletion',
});
res.type('html').send(html);
});

router.get(
'/delete/complete',
(req: Request, res: ResponseWithRequestState) => {
const html = renderer('/delete/complete', {
requestState: res.locals,
pageTitle: 'Account Deletion Complete',
});
res.type('html').send(html);
},
);

export default router.router;
4 changes: 4 additions & 0 deletions src/server/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { default as agree } from './agree';
import { default as changeEmail } from './changeEmail';
import { default as subscriptions } from './subscriptions';
import { default as consentToken } from './consentToken';
import { default as deleteAccount } from './delete';

const { okta } = getConfiguration();

Expand Down Expand Up @@ -79,6 +80,9 @@ if (okta.enabled) {
// consent token routes
uncachedRoutes.use(consentToken);

// delete account routes
uncachedRoutes.use(deleteAccount);

// email template routes
router.use(emailTemplates);

Expand Down
4 changes: 3 additions & 1 deletion src/shared/model/PageTitle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export type PageTitle =
| 'Subscribe Error'
| 'Subscribe Confirmation'
| 'Unsubscribe Error'
| 'Unsubscribe Confirmation';
| 'Unsubscribe Confirmation'
| 'Account Deletion'
| 'Account Deletion Complete';

export type PasswordPageTitle = Extract<
'Welcome' | 'Create Password' | 'Change Password',
Expand Down
2 changes: 2 additions & 0 deletions src/shared/model/Routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export const ValidRoutePathsArray = [
'/consent-token/error',
'/consent-token/resend',
'/consent-token/email-sent',
'/delete',
'/delete/complete',
'/error',
'/magic-link', //this is not being used until MVP4
'/magic-link/email-sent', //this is not being used until MVP4
Expand Down

0 comments on commit 299559e

Please sign in to comment.