Replies: 1 comment
-
When using SSR and fetch request require cookies you must ensure to pass the cookies during SSR to the fetch request. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I just started using SolidJS and I am very new. I am having a bit of trouble with
createResource
. Here is some example code:This code is working in conjunction with a C# backend that I am running locally.
When I save the file in my editor HMR does its thing and I get the data I am after -- it renders in the browser. However, when I refresh the page this code looks like it's being run on the server and does not render the JSON because the API call is failing. For some context, when a user logins to this application we set a cookie from the backend. Non-authed endpoints we have render fine because it doesn't matter if a cookie is available.
So, I believe it is failing because it does not have access to the cookie in the browser to authenticate the requests. Since there is no cookie for the server to access nothing is returned and no data is rendered.
Do I have to run this on the server? Why can't I just run this in the client? How might I fix this?
Beta Was this translation helpful? Give feedback.
All reactions