@vocollege/app 0.0.56 → 0.0.59
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/dist/{types.d.ts → global.d.ts} +4 -0
- package/dist/{types.js → global.js} +0 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +9 -3
- package/dist/interceptor.js +41 -12
- package/dist/modules/Services/I18n/I18n.js +1 -1
- package/dist/modules/Services/I18n/strings.json +716 -21
- package/dist/modules/Services/Vapor/Vapor.js +15 -7
- package/dist/modules/VoApi/GraphClient.d.ts +3 -2
- package/dist/modules/VoApi/GraphClient.js +57 -14
- package/dist/modules/VoApi/VoApi.d.ts +4 -1
- package/dist/modules/VoApi/VoApi.js +20 -2
- package/dist/modules/VoApi/graphql.d.ts +32 -0
- package/dist/modules/VoApi/graphql.js +57 -0
- package/dist/modules/VoApi/index.d.ts +1 -21
- package/dist/modules/VoApi/index.js +7 -31
- package/dist/modules/VoApi/mutations/acl.js +5 -5
- package/dist/modules/VoApi/mutations/applications.d.ts +3 -0
- package/dist/modules/VoApi/mutations/applications.js +12 -0
- package/dist/modules/VoApi/mutations/articles.js +3 -3
- package/dist/modules/VoApi/mutations/books.d.ts +3 -0
- package/dist/modules/VoApi/mutations/books.js +12 -0
- package/dist/modules/VoApi/mutations/cards.d.ts +3 -0
- package/dist/modules/VoApi/mutations/cards.js +12 -0
- package/dist/modules/VoApi/mutations/events.d.ts +3 -0
- package/dist/modules/VoApi/mutations/events.js +12 -0
- package/dist/modules/VoApi/mutations/navigation.js +3 -3
- package/dist/modules/VoApi/mutations/pages.js +3 -3
- package/dist/modules/VoApi/mutations/queues.js +3 -3
- package/dist/modules/VoApi/mutations/sections.d.ts +3 -0
- package/dist/modules/VoApi/mutations/sections.js +12 -0
- package/dist/modules/VoApi/mutations/settings.js +1 -1
- package/dist/modules/VoApi/mutations/users.js +3 -3
- package/dist/modules/VoApi/mutations/vodocs.js +9 -9
- package/dist/modules/VoApi/mutations/vogroups.d.ts +1 -0
- package/dist/modules/VoApi/mutations/vogroups.js +10 -9
- package/dist/modules/VoApi/queries/acl.js +4 -4
- package/dist/modules/VoApi/queries/applications.d.ts +2 -0
- package/dist/modules/VoApi/queries/applications.js +11 -0
- package/dist/modules/VoApi/queries/articles.js +2 -2
- package/dist/modules/VoApi/queries/books.d.ts +4 -0
- package/dist/modules/VoApi/queries/books.js +13 -0
- package/dist/modules/VoApi/queries/cards.d.ts +2 -0
- package/dist/modules/VoApi/queries/cards.js +11 -0
- package/dist/modules/VoApi/queries/events.d.ts +2 -0
- package/dist/modules/VoApi/queries/events.js +11 -0
- package/dist/modules/VoApi/queries/help.d.ts +1 -0
- package/dist/modules/VoApi/queries/help.js +11 -0
- package/dist/modules/VoApi/queries/navigation.js +4 -4
- package/dist/modules/VoApi/queries/pages.js +2 -2
- package/dist/modules/VoApi/queries/queues.js +2 -2
- package/dist/modules/VoApi/queries/search.d.ts +2 -0
- package/dist/modules/VoApi/queries/search.js +5 -3
- package/dist/modules/VoApi/queries/sections.d.ts +2 -0
- package/dist/modules/VoApi/queries/sections.js +11 -0
- package/dist/modules/VoApi/queries/settings.js +1 -1
- package/dist/modules/VoApi/queries/users.d.ts +1 -0
- package/dist/modules/VoApi/queries/users.js +5 -4
- package/dist/modules/VoApi/queries/vodocs.js +3 -3
- package/dist/modules/VoApi/queries/vogroups.d.ts +1 -0
- package/dist/modules/VoApi/queries/vogroups.js +9 -8
- package/dist/modules/VoApp.d.ts +1 -0
- package/dist/modules/VoApp.js +17 -0
- package/dist/modules/VoAuth.d.ts +2 -1
- package/dist/modules/VoAuth.js +126 -42
- package/dist/modules/VoBase.js +2 -2
- package/dist/modules/VoConfig.js +10 -0
- package/dist/modules/VoDocs/VoDocs.d.ts +1 -2
- package/dist/modules/VoDocs/VoDocs.js +12 -44
- package/dist/modules/VoGroups.d.ts +7 -0
- package/dist/modules/VoGroups.js +39 -0
- package/dist/modules/VoHelpers.d.ts +38 -1
- package/dist/modules/VoHelpers.js +348 -51
- package/dist/modules/VoRouter.js +10 -2
- package/dist/modules/{VoUtils.d.ts → VoUtils_REMOVE.d.ts} +1 -1
- package/dist/modules/{VoUtils.js → VoUtils_REMOVE.js} +16 -12
- package/package.json +17 -8
- package/src/global.ts +44 -0
- package/src/index.ts +3 -2
- package/src/interceptor.ts +39 -8
- package/src/modules/Services/I18n/strings.json +718 -22
- package/src/modules/Services/Vapor/Vapor.ts +14 -15
- package/src/modules/VoApi/GraphClient.ts +87 -24
- package/src/modules/VoApi/VoApi.ts +23 -3
- package/src/modules/VoApi/graphql.ts +47 -0
- package/src/modules/VoApi/index.ts +1 -37
- package/src/modules/VoApi/mutations/applications.ts +27 -0
- package/src/modules/VoApi/mutations/books.ts +27 -0
- package/src/modules/VoApi/mutations/cards.ts +27 -0
- package/src/modules/VoApi/mutations/events.ts +27 -0
- package/src/modules/VoApi/mutations/queues.ts +9 -1
- package/src/modules/VoApi/mutations/sections.ts +27 -0
- package/src/modules/VoApi/mutations/settings.ts +11 -3
- package/src/modules/VoApi/mutations/users.ts +19 -9
- package/src/modules/VoApi/mutations/vodocs.ts +4 -0
- package/src/modules/VoApi/mutations/vogroups.ts +21 -7
- package/src/modules/VoApi/queries/applications.ts +71 -0
- package/src/modules/VoApi/queries/articles.ts +26 -4
- package/src/modules/VoApi/queries/books.ts +101 -0
- package/src/modules/VoApi/queries/cards.ts +87 -0
- package/src/modules/VoApi/queries/events.ts +80 -0
- package/src/modules/VoApi/queries/help.ts +12 -0
- package/src/modules/VoApi/queries/navigation.ts +3 -4
- package/src/modules/VoApi/queries/pages.ts +29 -4
- package/src/modules/VoApi/queries/queues.ts +69 -4
- package/src/modules/VoApi/queries/search.ts +105 -4
- package/src/modules/VoApi/queries/sections.ts +63 -0
- package/src/modules/VoApi/queries/settings.ts +9 -3
- package/src/modules/VoApi/queries/users.ts +93 -8
- package/src/modules/VoApi/queries/vodocs.ts +8 -4
- package/src/modules/VoApi/queries/vogroups.ts +48 -2
- package/src/modules/VoApp.ts +25 -8
- package/src/modules/VoAuth.ts +136 -37
- package/src/modules/VoConfig.ts +13 -0
- package/src/modules/VoDocs/VoDocs.ts +31 -58
- package/src/modules/VoGroups.ts +33 -0
- package/src/modules/VoHelpers.ts +283 -43
- package/src/modules/VoRouter.ts +10 -3
- package/src/modules/{VoUtils.ts → VoUtils_REMOVE.ts} +17 -13
- package/src/types.ts +0 -38
package/src/interceptor.ts
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import VoAuth from "./modules/VoAuth";
|
|
3
3
|
import VoRouter from "./modules/VoRouter";
|
|
4
|
+
// import VoApp from "./modules/VoApp";
|
|
5
|
+
import { toast } from "react-toastify";
|
|
6
|
+
|
|
7
|
+
// Custom.
|
|
8
|
+
import I18n from "./modules/Services/I18n";
|
|
4
9
|
|
|
5
10
|
(function () {
|
|
6
11
|
let retry = 0;
|
|
7
12
|
|
|
8
13
|
async function redirect() {
|
|
9
|
-
|
|
10
|
-
|
|
14
|
+
try {
|
|
15
|
+
await VoAuth.logout();
|
|
16
|
+
VoRouter.redirectToLogout();
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.error("Interceptor", error);
|
|
19
|
+
}
|
|
11
20
|
}
|
|
21
|
+
|
|
12
22
|
axios.defaults.withCredentials = true;
|
|
23
|
+
axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";
|
|
13
24
|
|
|
14
25
|
axios.interceptors.request.use((req) => {
|
|
15
26
|
// console.log('Interceptor request', `${req.method} ${req.url}`);
|
|
@@ -22,21 +33,21 @@ import VoRouter from "./modules/VoRouter";
|
|
|
22
33
|
},
|
|
23
34
|
async (error) => {
|
|
24
35
|
const status = error.response ? error.response.status : null;
|
|
36
|
+
|
|
25
37
|
if (status && retry < 2) {
|
|
26
38
|
retry++;
|
|
27
39
|
switch (status) {
|
|
28
40
|
case 400:
|
|
29
41
|
case 401:
|
|
30
|
-
|
|
42
|
+
// case 403:
|
|
31
43
|
try {
|
|
32
44
|
await VoAuth.refreshToken();
|
|
33
45
|
const token: any = VoAuth.getToken();
|
|
34
46
|
|
|
35
|
-
retry = 0;
|
|
36
|
-
|
|
37
47
|
// Update the failed request with the new access token
|
|
38
|
-
// in order to
|
|
48
|
+
// in order to redo the call.
|
|
39
49
|
if (token) {
|
|
50
|
+
retry = 0;
|
|
40
51
|
error.config.headers["Authorization"] =
|
|
41
52
|
token.token_type + " " + token.access_token;
|
|
42
53
|
}
|
|
@@ -48,12 +59,32 @@ import VoRouter from "./modules/VoRouter";
|
|
|
48
59
|
// return Promise.reject(error);
|
|
49
60
|
}
|
|
50
61
|
break;
|
|
62
|
+
// case 419:
|
|
63
|
+
// console.log("LOG OUT");
|
|
64
|
+
// break;
|
|
51
65
|
}
|
|
52
66
|
}
|
|
53
67
|
|
|
54
|
-
redirect();
|
|
55
|
-
console.error("Interceptor", error);
|
|
68
|
+
// redirect();
|
|
69
|
+
// console.error("Interceptor", error);
|
|
56
70
|
// return Promise.reject(error);
|
|
71
|
+
return new Promise((resolve, reject) => {
|
|
72
|
+
switch (status) {
|
|
73
|
+
// case 403:
|
|
74
|
+
// reject(error);
|
|
75
|
+
// break;
|
|
76
|
+
case 419:
|
|
77
|
+
toast.error(I18n.get.messages.sessionExpired);
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
redirect();
|
|
80
|
+
}, 5000);
|
|
81
|
+
break;
|
|
82
|
+
default:
|
|
83
|
+
reject(error);
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
console.error("Interceptor", error);
|
|
87
|
+
});
|
|
57
88
|
}
|
|
58
89
|
);
|
|
59
90
|
})();
|