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 40 41 |
import { Client } from './client'
import Form from './form'
async function otherAction() {
'use server'
return 'hi'
}
// Test top-level encryption (happens during the module load phase)
function wrapAction(value, action, element) {
return async function () {
'use server'
const v = await action()
if (v === 'hi') {
console.log(value)
}
return element
}
}
const action = wrapAction(
'some-module-level-encryption-value',
otherAction,
<Client />
)
// Test runtime encryption (happens during the rendering phase)
export default function Page() {
const secret = 'my password is qwerty123'
return (
<Form
action={async () => {
'use server'
console.log(secret)
return action()
}}
/>
)
}
|