@inngageregistry/inngage-react 2.2.7 → 2.2.8

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/utils.js +20 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inngageregistry/inngage-react",
3
- "version": "2.2.7",
3
+ "version": "2.2.8",
4
4
  "description": "Inngage react integration",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/utils.js CHANGED
@@ -7,15 +7,28 @@ const baseUrlHook = {
7
7
  [true]: 'https://apid.inngage.com.br/v1',
8
8
  }
9
9
 
10
- const requestConfigFactory = (method, request) => ({
11
- headers: {
10
+ const requestConfigFactory = (method, request) => {
11
+
12
+ let header = {
12
13
  Accept: 'application/json',
13
14
  'Content-Type': 'application/json',
14
- Authorization: request.registerSubscriberRequest.authKey
15
- },
16
- method,
17
- body: JSON.stringify(request),
18
- })
15
+ }
16
+
17
+ if (request.registerSubscriberRequest.authKey) {
18
+ header = {
19
+ ...header,
20
+ Authorization: request.registerSubscriberRequest.authKey
21
+ }
22
+ }
23
+
24
+ let objToSend = {
25
+ method,
26
+ body: JSON.stringify(request),
27
+ headers: header
28
+ }
29
+
30
+ return objToSend
31
+ }
19
32
 
20
33
  export const fetchClient = (method, requestBody, path, isDev = false) => {
21
34
  return new Promise((resolve) => {