This repository has been archived on 2026-01-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
nextjs-auth0/utils/validateContext.ts
2024-07-08 00:00:06 +02:00

13 lines
299 B
TypeScript

import { ContextSchema } from '@utils/types';
export function validateContext(context: any) {
const validatedContext = ContextSchema.safeParse(context);
if (!validatedContext.success) {
throw new Error('Invalid context');
}
const { id } = validatedContext.data.params;
return id;
}