Setting cookies (or headers in general) from `createServerData$`
Is it possible to set cookies (or any other headers) from the fetcher passed to
createServerData$
?
I have the following code:
getSession
is just a wrapper around the cookie session storage that's built in to solid-start.
When I call useRouteData<typeof routeData>()
in my component I can get success
from the session. success
was set on a previous route as such:
Now I would like to commit the session with the flash message deleted. How can I do this from within createServerData$
? It doesn't seem that I'm able to return a Response
or anything like that, and redirect wouldn't make sense either.2 Replies
I came across this post: https://discordapp.com/channels/722131463138705510/1057288732555878530/1057384833497714688
Which lead me to do the following:
Inside
routeData()
And then inside the component:
And then I can use it in my tsx!
Thank you for sharing this. I'm currently facing the same issue and thought I was going crazy. I'm still confused why the data from createServerData$ isn't accessible to the component