next.js/test/e2e/app-dir/actions/app/header/validator.js
validator.js13 lines284 B
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)
  }
}
Quest for Codev2.0.0
/
SIGN IN