File size: 776 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
'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 }
|