foris 5.1.16-beta.43cb5bff → 5.2.0
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/api/hooks.js +3 -4
- package/api/utils.js +3 -2
- package/foris-5.2.0.tgz +0 -0
- package/package.json +1 -1
- package/utils/forisUrls.js +2 -2
- package/webSockets/WebSockets.js +1 -9
- package/foris-5.1.16.tgz +0 -0
package/api/hooks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
|
|
2
|
+
* Copyright (C) 2019-2021 CZ.NIC z.s.p.o. (http://www.nic.cz/)
|
|
3
3
|
*
|
|
4
4
|
* This is free software, licensed under the GNU General Public License v3.
|
|
5
5
|
* See /LICENSE for more information.
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
import { useCallback, useEffect, useReducer, useState } from "react";
|
|
9
9
|
|
|
10
|
-
import { ForisURLs } from "../utils/forisUrls";
|
|
11
10
|
import {
|
|
12
11
|
API_ACTIONS,
|
|
13
12
|
API_METHODS,
|
|
@@ -84,8 +83,8 @@ function APIReducer(state, action) {
|
|
|
84
83
|
data: action.payload,
|
|
85
84
|
};
|
|
86
85
|
case API_ACTIONS.FAILURE:
|
|
87
|
-
if (action.status ===
|
|
88
|
-
window.location.
|
|
86
|
+
if (action.status === 401) {
|
|
87
|
+
window.location.reload();
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
// Not an API error - should be rethrown.
|
package/api/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
|
|
2
|
+
* Copyright (C) 2019-2021 CZ.NIC z.s.p.o. (http://www.nic.cz/)
|
|
3
3
|
*
|
|
4
4
|
* This is free software, licensed under the GNU General Public License v3.
|
|
5
5
|
* See /LICENSE for more information.
|
|
@@ -11,6 +11,7 @@ export const HEADERS = {
|
|
|
11
11
|
Accept: "application/json",
|
|
12
12
|
"Content-Type": "application/json",
|
|
13
13
|
"X-CSRFToken": getCookie("_csrf_token"),
|
|
14
|
+
"X-Requested-With": "json",
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
export const TIMEOUT = 30500;
|
|
@@ -56,7 +57,7 @@ function getCookie(name) {
|
|
|
56
57
|
|
|
57
58
|
export function getErrorPayload(error) {
|
|
58
59
|
if (error.response) {
|
|
59
|
-
if (error.response.status ===
|
|
60
|
+
if (error.response.status === 401) {
|
|
60
61
|
return _("The session is expired. Please log in again.");
|
|
61
62
|
}
|
|
62
63
|
return getJSONErrorMessage(error);
|
package/foris-5.2.0.tgz
ADDED
|
Binary file
|
package/package.json
CHANGED
package/utils/forisUrls.js
CHANGED
|
@@ -9,8 +9,8 @@ export const REFORIS_URL_PREFIX = "/reforis";
|
|
|
9
9
|
export const REFORIS_API_URL_PREFIX = `${REFORIS_URL_PREFIX}/api`;
|
|
10
10
|
|
|
11
11
|
export const ForisURLs = {
|
|
12
|
-
login:
|
|
13
|
-
logout:
|
|
12
|
+
login: `/login?${REFORIS_URL_PREFIX}/`,
|
|
13
|
+
logout: `/logout`,
|
|
14
14
|
|
|
15
15
|
static: `${REFORIS_URL_PREFIX}/static/reforis`,
|
|
16
16
|
wifi: `${REFORIS_URL_PREFIX}/network-settings/wifi`,
|
package/webSockets/WebSockets.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C) 2020 CZ.NIC z.s.p.o. (http://www.nic.cz/)
|
|
2
|
+
* Copyright (C) 2020-2021 CZ.NIC z.s.p.o. (http://www.nic.cz/)
|
|
3
3
|
*
|
|
4
4
|
* This is free software, licensed under the GNU General Public License v3.
|
|
5
5
|
* See /LICENSE for more information.
|
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
/* eslint no-console: "off" */
|
|
9
9
|
|
|
10
|
-
import { ForisURLs } from "../utils/forisUrls";
|
|
11
|
-
|
|
12
10
|
const PROTOCOL = window.location.protocol === "http:" ? "ws" : "wss";
|
|
13
11
|
|
|
14
12
|
const URL = process.env.LIGHTTPD
|
|
@@ -21,12 +19,6 @@ export class WebSockets {
|
|
|
21
19
|
constructor() {
|
|
22
20
|
this.ws = new WebSocket(URL);
|
|
23
21
|
this.ws.onerror = (e) => {
|
|
24
|
-
if (!window.initialData.logged) {
|
|
25
|
-
console.error(
|
|
26
|
-
"WS: Error observed, you aren't logged probably."
|
|
27
|
-
);
|
|
28
|
-
window.location.replace(ForisURLs.login);
|
|
29
|
-
}
|
|
30
22
|
console.error("WS: Error:", e);
|
|
31
23
|
};
|
|
32
24
|
this.ws.onmessage = (e) => {
|
package/foris-5.1.16.tgz
DELETED
|
Binary file
|