@eduzz/miau-client 1.0.5-rc.113 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eduzz/miau-client",
3
- "version": "1.0.5-rc.113",
3
+ "version": "1.0.5",
4
4
  "description": "Eduzz Miau Client",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/src/MiauClient.ts CHANGED
@@ -43,13 +43,16 @@ const cacheableFetch = async <T>(input: FetchInput, init?: FetchInit) => {
43
43
  requestsCache.delete(cacheKey);
44
44
  }
45
45
 
46
- const newRequest = reusableFetch<T>(input, init).catch(err => {
46
+ try {
47
+ const newRequest = reusableFetch<T>(input, init);
48
+ requestsCache.set(cacheKey, newRequest);
49
+ const result = await newRequest;
50
+
51
+ return result.data as T;
52
+ } catch (err) {
47
53
  requestsCache.delete(cacheKey);
48
54
  throw err;
49
- });
50
-
51
- requestsCache.set(cacheKey, newRequest);
52
- return (await newRequest).data as T;
55
+ }
53
56
  };
54
57
 
55
58
  const expiresHeaderToUnixtime = (expires: string | null): number => {