@omniumretail/shared-resources 0.1.89 → 0.1.90

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.
@@ -2,6 +2,7 @@ import 'whatwg-fetch';
2
2
  export declare const get: <T>(path: string, params?: Record<string, unknown>) => Promise<T>;
3
3
  export declare const getAuth0: <T>(path: string, params?: Record<string, unknown>) => Promise<T>;
4
4
  export declare const putAuth0: <T>(path: string, params?: Record<string, unknown>, body?: unknown, bodyType?: string) => Promise<T>;
5
+ export declare const patchAuth0: <T>(path: string, params?: Record<string, unknown>, body?: unknown, bodyType?: string) => Promise<T>;
5
6
  export declare const postAuth0: <T>(path: string, params?: Record<string, unknown>, body?: unknown, bodyType?: string) => Promise<T>;
6
7
  export declare const toDeleteAuth0: <T>(path: string, params?: Record<string, unknown>, body?: unknown) => Promise<T>;
7
8
  export declare const post: <T>(path: string, body?: unknown) => Promise<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/shared-resources",
3
- "version": "0.1.89",
3
+ "version": "0.1.90",
4
4
  "private": false,
5
5
  "description": "Shared Components and services or utils to the frontend versions",
6
6
  "main": "dist/bundle.js",
@@ -13,6 +13,10 @@ export const putAuth0 = <T>(path: string, params?: Record<string, unknown>, body
13
13
  return buildApiRequestForAuth0<T>(`${path}${buildParams(params || {})}`, 'PUT', body, bodyType);
14
14
  }
15
15
 
16
+ export const patchAuth0 = <T>(path: string, params?: Record<string, unknown>, body?: unknown, bodyType?: string): Promise<T> => {
17
+ return buildApiRequestForAuth0<T>(`${path}${buildParams(params || {})}`, 'PATCH', body, bodyType);
18
+ }
19
+
16
20
  export const postAuth0 = <T>(path: string, params?: Record<string, unknown>, body?: unknown, bodyType?: string): Promise<T> => {
17
21
  return buildApiRequestForAuth0<T>(`${path}${buildParams(params || {})}`, 'POST', body, bodyType);
18
22
  }
@@ -55,7 +59,7 @@ const buildApiRequest = <T>(path: string, method = 'GET', data?: unknown, bodyTy
55
59
 
56
60
  let body: FormData | string | undefined | any;
57
61
 
58
- if (['POST', 'PUT'].includes(method)) {
62
+ if (['POST', 'PUT', 'PATCH'].includes(method)) {
59
63
  if (bodyType === 'formdata') {
60
64
  // Não é necessário dar set do contentType porque o fetch faz isso por nós quando usamos o fetch
61
65
  body = data;