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 +1 -1
- package/services/apiService.js +5 -7
- package/services/helper.js +13 -0
package/package.json
CHANGED
package/services/apiService.js
CHANGED
|
@@ -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 {
|
|
5
|
+
import { setCookie, destroyCookie } from 'nookies';
|
|
6
6
|
import { GetEnvironment } from "./BaseUri";
|
|
7
|
+
import helper from "./helper";
|
|
7
8
|
|
|
8
|
-
const setupDefaultOptions = async (ctx =
|
|
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 =
|
|
91
|
+
const apiService = (ctx = {}) => {
|
|
94
92
|
|
|
95
93
|
let env = GetEnvironment();
|
|
96
94
|
if (env == "development")
|