@webitel/ui-sdk 3.1.111 → 3.2.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
|
@@ -4,7 +4,7 @@ const notifyTransformer = (payload) => {
|
|
|
4
4
|
if (payload instanceof Error) {
|
|
5
5
|
eventBus.$emit('notification', {
|
|
6
6
|
type: 'error',
|
|
7
|
-
text: payload.response
|
|
7
|
+
text: payload.response?.data?.detail || payload.response?.data?.message,
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
return payload;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import BaseAPIService from './BaseAPIService';
|
|
2
|
+
import applyTransform, {
|
|
3
|
+
handleUnauthorized,
|
|
4
|
+
notify,
|
|
5
|
+
} from '../../../api/transformers';
|
|
2
6
|
|
|
3
7
|
class AuthAPI extends BaseAPIService {
|
|
4
8
|
async setToken(token) {
|
|
@@ -19,7 +23,10 @@ class AuthAPI extends BaseAPIService {
|
|
|
19
23
|
await this._instance.post(url, {});
|
|
20
24
|
this.removeToken();
|
|
21
25
|
} catch (err) {
|
|
22
|
-
throw err
|
|
26
|
+
throw applyTransform(err, [
|
|
27
|
+
handleUnauthorized,
|
|
28
|
+
notify,
|
|
29
|
+
]);
|
|
23
30
|
}
|
|
24
31
|
}
|
|
25
32
|
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import applyTransform, {
|
|
2
|
+
handleUnauthorized,
|
|
3
|
+
notify,
|
|
4
|
+
snakeToCamel,
|
|
5
|
+
} from '../../../api/transformers';
|
|
1
6
|
import BaseAPIService from './BaseAPIService';
|
|
2
7
|
|
|
3
8
|
class UserinfoAPI extends BaseAPIService {
|
|
@@ -9,9 +14,14 @@ class UserinfoAPI extends BaseAPIService {
|
|
|
9
14
|
const url = '/userinfo';
|
|
10
15
|
try {
|
|
11
16
|
const response = await this._instance.get(url);
|
|
12
|
-
return response
|
|
17
|
+
return applyTransform(response.data, [
|
|
18
|
+
snakeToCamel(),
|
|
19
|
+
]);
|
|
13
20
|
} catch (err) {
|
|
14
|
-
throw err
|
|
21
|
+
throw applyTransform(err, [
|
|
22
|
+
handleUnauthorized,
|
|
23
|
+
notify,
|
|
24
|
+
]);
|
|
15
25
|
}
|
|
16
26
|
// }
|
|
17
27
|
}
|
|
@@ -20,9 +30,14 @@ class UserinfoAPI extends BaseAPIService {
|
|
|
20
30
|
const url = 'role/metadata/access';
|
|
21
31
|
try {
|
|
22
32
|
const response = await this._instance.get(url);
|
|
23
|
-
return response
|
|
33
|
+
return applyTransform(response.data, [
|
|
34
|
+
snakeToCamel(),
|
|
35
|
+
]);
|
|
24
36
|
} catch (err) {
|
|
25
|
-
throw err
|
|
37
|
+
throw applyTransform(err, [
|
|
38
|
+
handleUnauthorized,
|
|
39
|
+
notify,
|
|
40
|
+
]);
|
|
26
41
|
}
|
|
27
42
|
}
|
|
28
43
|
}
|