Download next.js/test/e2e/app-dir/actions/app/header/validator.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 284 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/actions/app/header/validator.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/e2e/app-dir/actions/app/header/validator.js
-
curl -L -o validator.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/actions/app/header/validator.js
284 Bytes
| 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) | |
| } | |
| } | |