Why is the response of string type and not a json object
Answered
Broken Nokia posted this in #help-forum
Answered by Zepeto
try to add this
const response = await fetch(url, { cache: "no-cache" });
26 Replies
@Broken Nokia Why am I not able to log the value of "message" key from the response object?
If you log data, what do you get?
@Broken Nokia Click to see attachment
and if you log data.message ?
undefined
i noticed that mine has the key as a string while yours doesn't
could you please show me the route handler so i can compare it with mine
could you please show me the route handler so i can compare it with mine
i'm not sure how to work with codesandbox, i'll send the files here?
here's the structure for reference
Or maybe you can directly share your git repos ?
i'll make on github, give me a min
@Broken Nokia i'll make on github, give me a min
take your time no worries 🙂
try to add this
const response = await fetch(url, { cache: "no-cache" });
Answer
you're logging data.message?
wow
try to add no-cache en refresh
it worked
i can't list the number of times default caching behaviour has screwed me over so far
thank you 🙏
thank you 🙏
by default fetch is using cache (this will change in next 15)
@Zepeto by default fetch is using cache (this will change in next 15)
yep, waiting for the stable release just for this haha
have a good day, thank you again