mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2024-11-14 17:35:35 +01:00
Merge branch 'fix-ios-redirect-loop' into 'dev'
Fix iOS redirect loop Closes #19 See merge request turris/reforis/foris-js!154
This commit is contained in:
commit
80d4dd914d
21159
package-lock.json
generated
21159
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2020 CZ.NIC z.s.p.o. (http://www.nic.cz/)
|
* Copyright (C) 2020-2021 CZ.NIC z.s.p.o. (http://www.nic.cz/)
|
||||||
*
|
*
|
||||||
* This is free software, licensed under the GNU General Public License v3.
|
* This is free software, licensed under the GNU General Public License v3.
|
||||||
* See /LICENSE for more information.
|
* See /LICENSE for more information.
|
||||||
|
@ -7,8 +7,6 @@
|
||||||
|
|
||||||
/* eslint no-console: "off" */
|
/* eslint no-console: "off" */
|
||||||
|
|
||||||
import { ForisURLs } from "../utils/forisUrls";
|
|
||||||
|
|
||||||
const PROTOCOL = window.location.protocol === "http:" ? "ws" : "wss";
|
const PROTOCOL = window.location.protocol === "http:" ? "ws" : "wss";
|
||||||
|
|
||||||
const URL = process.env.LIGHTTPD
|
const URL = process.env.LIGHTTPD
|
||||||
|
@ -21,13 +19,7 @@ export class WebSockets {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.ws = new WebSocket(URL);
|
this.ws = new WebSocket(URL);
|
||||||
this.ws.onerror = (e) => {
|
this.ws.onerror = (e) => {
|
||||||
if (window.location.pathname !== ForisURLs.login) {
|
console.error("WS: Error observed:", e);
|
||||||
console.error(
|
|
||||||
"WS: Error observed, you aren't logged probably."
|
|
||||||
);
|
|
||||||
window.location.replace(ForisURLs.login);
|
|
||||||
}
|
|
||||||
console.error(`WS: Error: ${e}`);
|
|
||||||
};
|
};
|
||||||
this.ws.onmessage = (e) => {
|
this.ws.onmessage = (e) => {
|
||||||
console.debug(`WS: Received Message: ${e.data}`);
|
console.debug(`WS: Received Message: ${e.data}`);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user