Single request calling session multiple times for nextauth
Unanswered
Japanese jack mackerel posted this in #help-forum
Japanese jack mackerelOP
Is there anyway to not call session multiple times on a reload? im calling the discord api as part of it and i keep getting rate limited. checking network tab everytime i refresh it makes a call to the /session endpoint like 4 times. how do i make this just 1?
3 Replies
You can cache the data so that the /session endpoint returns cached data instead of sending a request again to the discord api.
Japanese jack mackerelOP
how would i go about that
I couldn't find the exact documentation, but you can refer https://discord.com/channels/752553802359505017/1298265974218428416/1298266463995560020 and https://nextjs.org/docs/app/building-your-application/caching plus https://nextjs.org/docs/app/api-reference/directives/use-cache (if you're on next 15)