next.js/test/e2e/app-dir/actions/app/client/actions.js
actions.js39 lines775 B
'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, 2000))
  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 }
Quest for Codev2.0.0
/
SIGN IN