-
I can't understand why this isn't working:
In the network tab I get the wrong request url, it looks like it's trying to add the headers to the request url which is weird. I guess I'm doing this wrong and I can't find anything about it in the docs or maby I don't understand it... How would you add the headers / Authorization ? |
Beta Was this translation helpful? Give feedback.
Answered by
promer94
Jun 10, 2023
Replies: 1 comment 1 reply
-
You fetcher fn should be const fetcher = async ([orgId, config]) => {
const response = await fetch(
`${process.env.NEXT_PUBLIC_APP_API_URL}/Admins/${orgId}`,
config
)
if (!response.ok) {
throw new Error('An error occurred while fetching the data.')
}
return response.json()
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
promer94
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You fetcher fn should be
https://swr.vercel.app/docs/typescript#useswr