authscape 1.0.16 → 1.0.20

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": "authscape",
3
- "version": "1.0.16",
3
+ "version": "1.0.20",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -2,19 +2,17 @@ import axios from 'axios'
2
2
  import querystring from 'querystring';
3
3
  import fileDownload from 'js-file-download';
4
4
  import cookies from 'next-cookies';
5
- import { parseCookies, setCookie, destroyCookie } from 'nookies';
5
+ import { setCookie, destroyCookie } from 'nookies';
6
6
  import { GetEnvironment } from "./BaseUri";
7
+ import helper from "./helper";
7
8
 
8
- const setupDefaultOptions = async (ctx = null) => {
9
+ const setupDefaultOptions = async (ctx = {}) => {
9
10
 
10
11
  let defaultOptions = {};
11
-
12
- if (ctx == null)
12
+ if (helper().isObjectEmpty(ctx))
13
13
  {
14
14
  let accessToken = cookies(ctx).access_token || '';
15
15
 
16
- // let accessToken = window.localStorage.getItem("access_token");
17
-
18
16
  if (accessToken !== null && accessToken !== undefined && accessToken != "") {
19
17
  defaultOptions = {
20
18
  headers: {
@@ -90,7 +88,7 @@ const RefreshToken = async (originalRequest, instance) => {
90
88
  }
91
89
  }
92
90
 
93
- const apiService = (ctx = null) => {
91
+ const apiService = (ctx = {}) => {
94
92
 
95
93
  let env = GetEnvironment();
96
94
  if (env == "development")
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+
3
+ const Helper = () => {
4
+
5
+ return {
6
+
7
+ isObjectEmpty: (obj) => {
8
+ return Object.keys(obj).length == 0;
9
+ }
10
+ }
11
+ }
12
+
13
+ export default Helper;