SolidJSS
SolidJSโ€ข2y agoโ€ข
1 reply
colinshen

How to set a cookie that is returned from api call?

I'm using createAsync for a server api call. The api returns data with cookie that I need later.
async function foo(){
"use server";
const res = await callApi();
// how append a cookie here?
return res.data
}
createAsync(()=> foo())

I tried appendHeader before return, but I got error Cannot set headers after they are sent to the client.
Was this page helpful?