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:
parent
7c459aef1a
commit
6b21befcb9
1 changed files with 4 additions and 1 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Reference in a new issue