infisical icon indicating copy to clipboard operation
infisical copied to clipboard

Using HTTP Client instead of Fetch

Open SH5H opened this issue 3 years ago • 6 comments

Feature description

Add HTTP Client

Why would it be useful?

Fetch is good. But it's hard to handle HTTP errors. So, I recommend using an HTTP client like Axios or Ky.

Additional context

Add any other context about the problem here.

SH5H avatar Dec 06 '22 20:12 SH5H

Great suggestion, Axios does allow eaiser interceptor globally. Are there some usecases you can think of that would benefit Infisical by switching over from fetch? Other than global error handling, I can't think of much. fyi @mv-turtle

maidul98 avatar Dec 06 '22 20:12 maidul98

We can reduce the amount of code. We use every fetch function with a new config. If we use an HTTP client instance, can set the config at once and re-use in every file.

SH5H avatar Dec 06 '22 22:12 SH5H

This is probably a good idea! Axios is great!

vmatsiiako avatar Dec 07 '22 02:12 vmatsiiako

Using a Server state management library e.g React-Query paired with Axios might also be beneficial. We can prefetch keys before the user is routed to the dashboard and perform Mutation when sending data to the database.

LemmyMwaura avatar Dec 12 '22 16:12 LemmyMwaura

@LemmyMwaura this is a very cool idea! I think someone else proposed it in another issue

vmatsiiako avatar Dec 12 '22 16:12 vmatsiiako

@mv-turtle Ooh Okay. if you decide to move in that direction. Let me know, I can help out.

LemmyMwaura avatar Dec 12 '22 16:12 LemmyMwaura

Is this being worked on already? Would like to tackle this if it isn't?

leanjunio avatar Apr 15 '23 22:04 leanjunio

Closing as its stale and we already migrated to this

akhilmhdh avatar Oct 09 '23 06:10 akhilmhdh