1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-09 00:00:01 +01:00

Show Server not reachable notification only once #68

This commit is contained in:
Laura Fuentes Grau 2020-10-23 14:07:05 +02:00
parent 7c459aef1a
commit 6b21befcb9

View file

@ -47,6 +47,8 @@ function isNetworkError(err) {
return result;
}
let prevURL = null;
class RestAPI {
get(url, token) {
return new Promise(function (resolve, reject) {
@ -58,7 +60,8 @@ class RestAPI {
req.end(function (error, res) {
if (res == null || res.status !== 200) {
error.handled = isNetworkError(error);
if (req.url !== prevURL) error.handled = isNetworkError(error);
prevURL = req.url;
reject(error);
} else {
resolve(JSON.parse(res.text));