@stackfactor/client-api 1.0.31 → 1.0.33
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/index.js +0 -2
- package/lib/actionNotifications.js +202 -226
- package/lib/address.js +21 -27
- package/lib/axiosClient.js +58 -64
- package/lib/config.js +62 -66
- package/lib/dashboard.js +64 -68
- package/lib/departmentTrainingPlans.js +159 -153
- package/lib/groups.js +266 -291
- package/lib/integration.js +307 -312
- package/lib/integrationConfiguration.js +96 -90
- package/lib/integrations/contentGenerator.js +71 -74
- package/lib/learningContent.js +239 -240
- package/lib/logger.js +51 -56
- package/lib/role.js +238 -245
- package/lib/roleTemplate.js +247 -255
- package/lib/skill.js +299 -311
- package/lib/skillAssessmentTestingSession.js +132 -137
- package/lib/skillAssessments.js +125 -129
- package/lib/skillTemplate.js +250 -255
- package/lib/teams.js +261 -257
- package/lib/tenants.js +48 -52
- package/lib/trainingPlanTemplate.js +203 -202
- package/lib/trainingPlans.js +249 -251
- package/lib/userInformation.js +97 -85
- package/lib/users.js +557 -555
- package/lib/utils.js +38 -42
- package/package.json +1 -1
- package/lib/templates.js +0 -148
package/index.js
CHANGED
|
@@ -18,7 +18,6 @@ const skillAssessment = require("./lib/skillAssessments");
|
|
|
18
18
|
const skillAssessmentTestingSession = require("./lib/skillAssessmentTestingSession");
|
|
19
19
|
const skillTemplate = require("./lib/skillTemplate");
|
|
20
20
|
const team = require("./lib/teams");
|
|
21
|
-
const templates = require("./lib/templates");
|
|
22
21
|
const tenant = require("./lib/tenants");
|
|
23
22
|
const trainingPlanTemplate = require("./lib/trainingPlanTemplate");
|
|
24
23
|
const trainingPlan = require("./lib/trainingPlans");
|
|
@@ -51,7 +50,6 @@ module.exports = {
|
|
|
51
50
|
skillAssessmentTestingSession,
|
|
52
51
|
skillTemplate,
|
|
53
52
|
team,
|
|
54
|
-
templates,
|
|
55
53
|
tenant,
|
|
56
54
|
trainingPlanTemplate,
|
|
57
55
|
trainingPlan,
|
|
@@ -1,240 +1,216 @@
|
|
|
1
|
-
import
|
|
1
|
+
import axios from "./axiosClient";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Get all permissions
|
|
5
|
+
* @param {String} authToken The authentication token
|
|
6
|
+
*/
|
|
7
|
+
export const getAllUserNotifications = (authToken) => {
|
|
8
|
+
return new Promise(function (resolve, reject) {
|
|
9
|
+
const request = axios.get(`api/v1/actionnotifications`, {
|
|
10
|
+
headers: { authorization: authToken },
|
|
11
|
+
});
|
|
12
|
+
request
|
|
13
|
+
.then((response) => {
|
|
14
|
+
resolve(response.data);
|
|
15
|
+
})
|
|
16
|
+
.catch((error) => {
|
|
17
|
+
reject(error);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
};
|
|
5
21
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Mark notifications as open or viewed
|
|
24
|
+
* @param {Array<String>} ids The id of the notifications to be marked
|
|
25
|
+
* @param {String} status The new status
|
|
26
|
+
* @param {String} authToken The authentication token
|
|
27
|
+
*/
|
|
28
|
+
export const markNotifications = (ids, status, authToken) => {
|
|
29
|
+
return new Promise(function (resolve, reject) {
|
|
30
|
+
const request = axios.put(
|
|
31
|
+
`api/v1/actionnotifications/mark`,
|
|
32
|
+
{
|
|
33
|
+
ids: ids,
|
|
34
|
+
status: status,
|
|
35
|
+
},
|
|
36
|
+
{ headers: { authorization: authToken } }
|
|
37
|
+
);
|
|
38
|
+
request
|
|
39
|
+
.then((response) => {
|
|
40
|
+
resolve(response.data);
|
|
41
|
+
})
|
|
42
|
+
.catch((error) => {
|
|
43
|
+
reject(error);
|
|
14
44
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
resolve(response.data);
|
|
18
|
-
})
|
|
19
|
-
.catch((error) => {
|
|
20
|
-
reject(error);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
},
|
|
45
|
+
});
|
|
46
|
+
};
|
|
24
47
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Process a notification
|
|
50
|
+
* @param {String} id The notification id
|
|
51
|
+
* @param {String} action The action to be executed
|
|
52
|
+
* @param {String} comment The comment to be saved in the notification
|
|
53
|
+
* @param {String} authToken The authentication token
|
|
54
|
+
*/
|
|
55
|
+
export const processNotification = (id, action, comment, authToken) => {
|
|
56
|
+
return new Promise(function (resolve, reject) {
|
|
57
|
+
const request = axios.put(
|
|
58
|
+
`api/v1/actionnotifications/process`,
|
|
59
|
+
{
|
|
60
|
+
id: id,
|
|
61
|
+
action: action,
|
|
62
|
+
comment: comment,
|
|
63
|
+
},
|
|
64
|
+
{ headers: { authorization: authToken } }
|
|
65
|
+
);
|
|
66
|
+
request
|
|
67
|
+
.then((response) => {
|
|
68
|
+
resolve(response.data);
|
|
69
|
+
})
|
|
70
|
+
.catch((error) => {
|
|
71
|
+
reject(error);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
};
|
|
50
75
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return new Promise(function (resolve, reject) {
|
|
60
|
-
const request = axios.put(
|
|
61
|
-
`api/v1/actionnotifications/process`,
|
|
62
|
-
{
|
|
63
|
-
id: id,
|
|
64
|
-
action: action,
|
|
65
|
-
comment: comment,
|
|
66
|
-
},
|
|
67
|
-
{ headers: { authorization: authToken } }
|
|
68
|
-
);
|
|
69
|
-
request
|
|
70
|
-
.then((response) => {
|
|
71
|
-
resolve(response.data);
|
|
72
|
-
})
|
|
73
|
-
.catch((error) => {
|
|
74
|
-
reject(error);
|
|
75
|
-
});
|
|
76
|
+
/**
|
|
77
|
+
* Get groups for current tenant
|
|
78
|
+
* @param {String} authToken The authentication token
|
|
79
|
+
*/
|
|
80
|
+
export const getGroups = (authToken) => {
|
|
81
|
+
return new Promise(function (resolve, reject) {
|
|
82
|
+
const request = axios.get(`api/v1/groups/`, {
|
|
83
|
+
headers: { authorization: authToken },
|
|
76
84
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
getGroups: (authToken) => {
|
|
84
|
-
return new Promise(function (resolve, reject) {
|
|
85
|
-
const request = axios.get(`api/v1/groups/`, {
|
|
86
|
-
headers: { authorization: authToken },
|
|
85
|
+
request
|
|
86
|
+
.then((response) => {
|
|
87
|
+
resolve(response.data);
|
|
88
|
+
})
|
|
89
|
+
.catch((error) => {
|
|
90
|
+
reject(error);
|
|
87
91
|
});
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
resolve(response.data);
|
|
91
|
-
})
|
|
92
|
-
.catch((error) => {
|
|
93
|
-
reject(error);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
},
|
|
92
|
+
});
|
|
93
|
+
};
|
|
97
94
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
});
|
|
107
|
-
request
|
|
108
|
-
.then((response) => {
|
|
109
|
-
resolve(response.data);
|
|
110
|
-
})
|
|
111
|
-
.catch((error) => {
|
|
112
|
-
reject(error);
|
|
113
|
-
});
|
|
95
|
+
/**
|
|
96
|
+
* Get current user permissions
|
|
97
|
+
* @param {String} authToken The authentication token
|
|
98
|
+
*/
|
|
99
|
+
export const getUserPermissions = (authToken) => {
|
|
100
|
+
return new Promise(function (resolve, reject) {
|
|
101
|
+
const request = axios.get(`api/v1/groups/users/getuserpermissions`, {
|
|
102
|
+
headers: { authorization: authToken },
|
|
114
103
|
});
|
|
115
|
-
|
|
104
|
+
request
|
|
105
|
+
.then((response) => {
|
|
106
|
+
resolve(response.data);
|
|
107
|
+
})
|
|
108
|
+
.catch((error) => {
|
|
109
|
+
reject(error);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
};
|
|
116
113
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
*/
|
|
143
|
-
removePermissionsFromGroup: (groupId, permissions, authToken) => {
|
|
144
|
-
return new Promise(function (resolve, reject) {
|
|
145
|
-
const request = axios.post(
|
|
146
|
-
`api/v1/groups/permissions/remove/`,
|
|
147
|
-
{
|
|
148
|
-
groupId: groupId,
|
|
149
|
-
permissions: permissions,
|
|
150
|
-
},
|
|
151
|
-
{ headers: { authorization: authToken } }
|
|
152
|
-
);
|
|
153
|
-
request
|
|
154
|
-
.then((response) => {
|
|
155
|
-
resolve(response.data);
|
|
156
|
-
})
|
|
157
|
-
.catch((error) => {
|
|
158
|
-
reject(error);
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
},
|
|
114
|
+
/**
|
|
115
|
+
* Remove permissions from group
|
|
116
|
+
* @param {String} groupId The group Id
|
|
117
|
+
* @param {Array<String>} permissions The permissions to be removed from the group
|
|
118
|
+
* @param {String} authToken The authentication token
|
|
119
|
+
*/
|
|
120
|
+
export const removePermissionsFromGroup = (groupId, permissions, authToken) => {
|
|
121
|
+
return new Promise(function (resolve, reject) {
|
|
122
|
+
const request = axios.post(
|
|
123
|
+
`api/v1/groups/permissions/remove/`,
|
|
124
|
+
{
|
|
125
|
+
groupId: groupId,
|
|
126
|
+
permissions: permissions,
|
|
127
|
+
},
|
|
128
|
+
{ headers: { authorization: authToken } }
|
|
129
|
+
);
|
|
130
|
+
request
|
|
131
|
+
.then((response) => {
|
|
132
|
+
resolve(response.data);
|
|
133
|
+
})
|
|
134
|
+
.catch((error) => {
|
|
135
|
+
reject(error);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
};
|
|
162
139
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Remove users from group
|
|
142
|
+
* @param {String} groupId The group Id
|
|
143
|
+
* @param {Array<String>} users The users to be removed from the group
|
|
144
|
+
* @param {String} authToken The authentication token
|
|
145
|
+
*/
|
|
146
|
+
export const removeUsersFromGroup = (groupId, users, authToken) => {
|
|
147
|
+
return new Promise(function (resolve, reject) {
|
|
148
|
+
const request = axios.post(
|
|
149
|
+
`api/v1/groups/users/remove/`,
|
|
150
|
+
{
|
|
151
|
+
groupId: groupId,
|
|
152
|
+
users: users,
|
|
153
|
+
},
|
|
154
|
+
{ headers: { authorization: authToken } }
|
|
155
|
+
);
|
|
156
|
+
request
|
|
157
|
+
.then((response) => {
|
|
158
|
+
resolve(response.data);
|
|
159
|
+
})
|
|
160
|
+
.catch((error) => {
|
|
161
|
+
reject(error);
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
};
|
|
188
165
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
166
|
+
/*
|
|
167
|
+
* Set group as defualt
|
|
168
|
+
* @param {String} groupId The group Id
|
|
169
|
+
* @param {String} authToken The authentication token
|
|
170
|
+
*/
|
|
171
|
+
export const setDefault = (groupId, authToken) => {
|
|
172
|
+
return new Promise(function (resolve, reject) {
|
|
173
|
+
const request = axios.put(
|
|
174
|
+
`api/v1/groups/setDefault/`,
|
|
175
|
+
{
|
|
176
|
+
id: groupId,
|
|
177
|
+
},
|
|
178
|
+
{ headers: { authorization: authToken } }
|
|
179
|
+
);
|
|
180
|
+
request
|
|
181
|
+
.then((response) => {
|
|
182
|
+
resolve(response.data);
|
|
183
|
+
})
|
|
184
|
+
.catch((error) => {
|
|
185
|
+
reject(error);
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
};
|
|
212
189
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
},
|
|
190
|
+
/**
|
|
191
|
+
* Update group
|
|
192
|
+
* @param {String} groupId The group Id
|
|
193
|
+
* @param {string} name The updated name of the group
|
|
194
|
+
* @param {string} description The updated description of the group
|
|
195
|
+
* @param {String} authToken The authentication token
|
|
196
|
+
*/
|
|
197
|
+
export const updateGroup = (groupId, name, description, authToken) => {
|
|
198
|
+
return new Promise(function (resolve, reject) {
|
|
199
|
+
const request = axios.patch(
|
|
200
|
+
`api/v1/groups/group/`,
|
|
201
|
+
{
|
|
202
|
+
id: groupId,
|
|
203
|
+
name: name,
|
|
204
|
+
description: description,
|
|
205
|
+
},
|
|
206
|
+
{ headers: { authorization: authToken } }
|
|
207
|
+
);
|
|
208
|
+
request
|
|
209
|
+
.then((response) => {
|
|
210
|
+
resolve(response.data);
|
|
211
|
+
})
|
|
212
|
+
.catch((error) => {
|
|
213
|
+
reject(error);
|
|
214
|
+
});
|
|
215
|
+
});
|
|
240
216
|
};
|
package/lib/address.js
CHANGED
|
@@ -1,29 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import axios from "./axiosClient";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
.catch((error) => {
|
|
25
|
-
reject(error);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
},
|
|
3
|
+
/**
|
|
4
|
+
* Validate Address
|
|
5
|
+
* @param {String} input - the address in raw format
|
|
6
|
+
* @param {String} authToken - Authorization token
|
|
7
|
+
*/
|
|
8
|
+
export const autoComplete = (input, authToken) => {
|
|
9
|
+
return new Promise(function (resolve, reject) {
|
|
10
|
+
const getAddressesRequest = axios.post(
|
|
11
|
+
`api/v1/address/autocomplete/`,
|
|
12
|
+
{ input: input },
|
|
13
|
+
{ headers: { authorization: authToken } }
|
|
14
|
+
);
|
|
15
|
+
getAddressesRequest
|
|
16
|
+
.then((response) => {
|
|
17
|
+
resolve(response.data);
|
|
18
|
+
})
|
|
19
|
+
.catch((error) => {
|
|
20
|
+
reject(error);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
29
23
|
};
|
package/lib/axiosClient.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import client from "axios";
|
|
2
|
+
import https from "https";
|
|
3
|
+
import utils from "./utils";
|
|
4
4
|
|
|
5
5
|
const baseUrl = utils.getBaseUrl();
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
export default client.create({
|
|
8
8
|
baseURL: baseUrl,
|
|
9
9
|
httpsAgent: new https.Agent({
|
|
10
10
|
rejectUnauthorized: false,
|
|
@@ -12,71 +12,65 @@ let instance = axios.create({
|
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Returns the error as a string
|
|
16
|
+
* @param {Object} error
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
});
|
|
33
|
-
return asString;
|
|
34
|
-
} else if (error.response.data.error) {
|
|
35
|
-
return error.response.data.error.toString();
|
|
36
|
-
} else if (error.response.statusText) {
|
|
37
|
-
return error.response.statusText.toString();
|
|
38
|
-
} else {
|
|
39
|
-
return error.response.data.toString();
|
|
40
|
-
}
|
|
18
|
+
export const errorToString = (error) => {
|
|
19
|
+
if (error != null) {
|
|
20
|
+
if (error?.response?.data) {
|
|
21
|
+
let asString = "";
|
|
22
|
+
if (Array.isArray(error.response.data.errors)) {
|
|
23
|
+
error.response.data.errors.forEach((item, index) => {
|
|
24
|
+
asString += `${index > 0 ? ", " : ""} ${item.msg} param ${
|
|
25
|
+
item.param
|
|
26
|
+
} ${item.value ? `value ${item.value.toString()}` : ""}`;
|
|
27
|
+
});
|
|
28
|
+
return asString;
|
|
29
|
+
} else if (error.response.data.error) {
|
|
30
|
+
return error.response.data.error.toString();
|
|
31
|
+
} else if (error.response.statusText) {
|
|
32
|
+
return error.response.statusText.toString();
|
|
41
33
|
} else {
|
|
42
|
-
return error.
|
|
34
|
+
return error.response.data.toString();
|
|
43
35
|
}
|
|
36
|
+
} else {
|
|
37
|
+
return error.message ? error.message : "Unknown error";
|
|
44
38
|
}
|
|
45
|
-
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
46
41
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Returns the code of the error as a number
|
|
44
|
+
* @param {Object} error
|
|
45
|
+
* @returns {Number} The error code
|
|
46
|
+
*/
|
|
47
|
+
export const getErrorType = (error) => {
|
|
48
|
+
if (error?.response?.status) {
|
|
49
|
+
return error.response.status;
|
|
50
|
+
} else return responseType.SERVICE_UNAVAILABLE;
|
|
51
|
+
};
|
|
57
52
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Return the error information to include just the status and the message
|
|
55
|
+
* @param {Object} error
|
|
56
|
+
* @returns Object
|
|
57
|
+
*/
|
|
58
|
+
export const getErrorInformation = (error) => {
|
|
59
|
+
return {
|
|
60
|
+
status: getErrorType(error),
|
|
61
|
+
message: errorToString(error),
|
|
62
|
+
};
|
|
63
|
+
};
|
|
69
64
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
},
|
|
65
|
+
/**
|
|
66
|
+
* Returns true if an exception should be handled to the business and presentation layer
|
|
67
|
+
* @param {Boolean} returnAllExceptions - If set true all exceptions will be passed
|
|
68
|
+
* @param {Object} error - The error returned by the server
|
|
69
|
+
*/
|
|
70
|
+
export const shouldReturnError = (returnAllExceptions, error) => {
|
|
71
|
+
if (getErrorType(error) === responseType.UNAUTHORIZED) {
|
|
72
|
+
return returnAllExceptions;
|
|
73
|
+
} else {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
82
76
|
};
|