Download next.js/test/e2e/app-dir/actions/app/client/actions.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 776 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/actions/app/client/actions.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/e2e/app-dir/actions/app/client/actions.js
-
curl -L -o actions.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/actions/app/client/actions.js
776 Bytes
| 'use server' | |
| import 'server-only' | |
| import { redirect } from 'next/navigation' | |
| import { headers, cookies } from 'next/headers' | |
| export async function getHeaders() { | |
| console.log('accept header:', (await headers()).get('accept')) | |
| ;(await cookies()).set('test-cookie', Date.now()) | |
| } | |
| export async function inc(value) { | |
| return value + 1 | |
| } | |
| export async function slowInc(value) { | |
| await new Promise((resolve) => setTimeout(resolve, 10000)) | |
| return value + 1 | |
| } | |
| export async function dec(value) { | |
| return value - 1 | |
| } | |
| export default async function (value) { | |
| console.log('this_is_sensitive_info') | |
| return value * 2 | |
| } | |
| export async function redirectAction(path) { | |
| redirect(path) | |
| } | |
| const original = async () => { | |
| console.log('action') | |
| } | |
| export { original as renamed } | |