Back

Intercepting Request from NextJS to Appwrite

  • 0
  • Tools
  • General
  • Web
Suiii
3 Dec, 2023, 13:28

how can I get the status if the request are being made from nextjs to appwrite, something like request interceptor

TL;DR
The user is asking how to intercept requests from NextJS to Appwrite in order to check if the requests are being made. They are wondering if there is a way to create an interceptor using the Appwrite SDK. Another user suggests subclassing the client to create an interceptor, but it is not clear if this is a viable solution. The user also mentions using a loading spinner and asks if there is a way to show the spinner only when certain data is being fetched. Another user suggests using a Boolean variable to control the spinner's visibility and explains how to implement it. There is no clear solution provided in the thread.
Drake
3 Dec, 2023, 14:12

Do you mean from server side? Why?

Suiii
3 Dec, 2023, 14:23

To check if requests being made, i do spinner component

Drake
3 Dec, 2023, 14:26

Uhh...typically, what you do is have a Boolean to show or hide the spinner. Before making the API call, set the Boolean to true. After the API call, set the Boolean to false 🧐

Suiii
3 Dec, 2023, 14:29

πŸ˜‚πŸ˜‚πŸ˜‚ right going to have boolean to check loading status. But intercepted requests. I only check once , then showing spinner . No need to do for all components

Drake
3 Dec, 2023, 14:30

But wouldn't you show the loading spinner specifically at a certain spot related to the data being fetched? 🧐

Suiii
3 Dec, 2023, 14:31

Right but once globally

Drake
3 Dec, 2023, 14:45

Hmm ...well the SDK doesn't have any interceptor....but maybe you can make one by subclassing the client

Suiii
3 Dec, 2023, 16:12

will try to check it out.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more