File size: 284 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import { cookies } from 'next/headers'
export function validator(action) {
return async function (arg) {
'use server'
const auth = (await cookies()).get('auth')
if (auth?.value !== '1') {
throw new Error('Unauthorized request')
}
return action(arg)
}
}
|