@open-tender/cloud 0.1.45 → 0.1.46

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.
@@ -29,13 +29,20 @@ exports.fetchConfig = (0, toolkit_1.createAsyncThunk)(ConfigActionType.FetchConf
29
29
  try {
30
30
  const api = new api_1.default(options);
31
31
  const response = yield api.getConfig();
32
- const app = {
33
- baseUrl: options.baseUrl,
34
- authUrl: options.authUrl,
35
- clientId: options.clientId,
36
- brandId: options.brandId
37
- };
38
- options.callback && options.callback();
32
+ // const app = {
33
+ // baseUrl: options.baseUrl,
34
+ // authUrl: options.authUrl,
35
+ // clientId: options.clientId,
36
+ // brandId: options.brandId
37
+ // }
38
+ const { baseUrl, authUrl, clientId, brandId, callback } = options;
39
+ const app = { baseUrl, authUrl, clientId, brandId };
40
+ if (!app.clientId)
41
+ app.clientId = response.clientId;
42
+ if (!app.brandId)
43
+ app.brandId = response.brand.brandId;
44
+ if (callback)
45
+ callback();
39
46
  return Object.assign(Object.assign({}, response), { app });
40
47
  }
41
48
  catch (err) {
@@ -25,13 +25,20 @@ export const fetchConfig = createAsyncThunk(ConfigActionType.FetchConfig, (optio
25
25
  try {
26
26
  const api = new OpenTenderAPI(options);
27
27
  const response = yield api.getConfig();
28
- const app = {
29
- baseUrl: options.baseUrl,
30
- authUrl: options.authUrl,
31
- clientId: options.clientId,
32
- brandId: options.brandId
33
- };
34
- options.callback && options.callback();
28
+ // const app = {
29
+ // baseUrl: options.baseUrl,
30
+ // authUrl: options.authUrl,
31
+ // clientId: options.clientId,
32
+ // brandId: options.brandId
33
+ // }
34
+ const { baseUrl, authUrl, clientId, brandId, callback } = options;
35
+ const app = { baseUrl, authUrl, clientId, brandId };
36
+ if (!app.clientId)
37
+ app.clientId = response.clientId;
38
+ if (!app.brandId)
39
+ app.brandId = response.brand.brandId;
40
+ if (callback)
41
+ callback();
35
42
  return Object.assign(Object.assign({}, response), { app });
36
43
  }
37
44
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/cloud",
3
- "version": "0.1.45",
3
+ "version": "0.1.46",
4
4
  "description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our cloud-based Order API.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",