@carbonorm/carbonnode 1.5.0 → 1.5.1

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": "@carbonorm/carbonnode",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "browser": "dist/index.umd.js",
@@ -366,7 +366,7 @@ export default function restApi<
366
366
  C6,
367
367
  axios = axiosInstance,
368
368
  restURL = '/rest/',
369
- withCredentials = true,
369
+ withCredentials = true,
370
370
  tableName,
371
371
  requestMethod = GET,
372
372
  queryCallback = {},
@@ -681,45 +681,60 @@ export default function restApi<
681
681
 
682
682
  const axiosActiveRequest: AxiosPromise<ResponseDataType> = axios[requestMethod.toLowerCase()]<ResponseDataType>(
683
683
  restRequestUri,
684
- {
685
- withCredentials: withCredentials,
686
- ...((() => {
684
+ ...((() => {
687
685
 
688
- if (requestMethod === GET) {
686
+ // @link - https://axios-http.com/docs/instance
687
+ // How configuration vs data is passed is variable, use documentation above for reference
688
+ if (requestMethod === GET) {
689
689
 
690
- return {
691
- params: query
692
- }
693
-
694
- } else if (requestMethod === POST) {
690
+ return [{
691
+ withCredentials: withCredentials,
692
+ params: query
693
+ }]
695
694
 
696
- if (undefined !== request?.dataInsertMultipleRows) {
695
+ } else if (requestMethod === POST) {
697
696
 
698
- return request.dataInsertMultipleRows.map(data =>
699
- convertForRequestBody<typeof data>(data, fullTableList, C6, (message) => toast.error(message, toastOptions)));
697
+ if (undefined !== request?.dataInsertMultipleRows) {
700
698
 
701
- }
699
+ return [
700
+ request.dataInsertMultipleRows.map(data =>
701
+ convertForRequestBody<typeof data>(data, fullTableList, C6, (message) => toast.error(message, toastOptions))),
702
+ {
703
+ withCredentials: withCredentials,
704
+ }
705
+ ]
702
706
 
703
- return convertForRequestBody<RestTableInterfaces>(query as RestTableInterfaces, fullTableList, C6, (message) => toast.error(message, toastOptions))
704
-
705
- } else if (requestMethod === PUT) {
707
+ }
706
708
 
707
- return convertForRequestBody<RestTableInterfaces>(query as RestTableInterfaces, fullTableList, C6, (message) => toast.error(message, toastOptions))
709
+ return [
710
+ convertForRequestBody<RestTableInterfaces>(query as RestTableInterfaces, fullTableList, C6, (message) => toast.error(message, toastOptions)),
711
+ {
712
+ withCredentials: withCredentials,
713
+ }
714
+ ]
708
715
 
709
- } else if (requestMethod === DELETE) {
716
+ } else if (requestMethod === PUT) {
710
717
 
711
- return {
712
- data: convertForRequestBody<RestTableInterfaces>(query as RestTableInterfaces, fullTableList, C6, (message) => toast.error(message, toastOptions))
718
+ return [
719
+ convertForRequestBody<RestTableInterfaces>(query as RestTableInterfaces, fullTableList, C6, (message) => toast.error(message, toastOptions)),
720
+ {
721
+ withCredentials: withCredentials,
713
722
  }
723
+ ]
724
+ } else if (requestMethod === DELETE) {
714
725
 
715
- } else {
726
+ return [{
727
+ withCredentials: withCredentials,
728
+ data: convertForRequestBody<RestTableInterfaces>(query as RestTableInterfaces, fullTableList, C6, (message) => toast.error(message, toastOptions))
729
+ }]
716
730
 
717
- throw new Error('The request method (' + requestMethod + ') was not recognized.')
731
+ } else {
718
732
 
719
- }
733
+ throw new Error('The request method (' + requestMethod + ') was not recognized.')
720
734
 
721
- })())
722
- }
735
+ }
736
+
737
+ })())
723
738
  );
724
739
 
725
740
  if (cachingConfirmed) {