From f0536b634731996db9cbb6aa576cf36e2cb8973f Mon Sep 17 00:00:00 2001 From: Ildar Kamalov Date: Tue, 19 Feb 2019 19:42:59 +0300 Subject: [PATCH] Check response --- client/src/helpers/helpers.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/src/helpers/helpers.js b/client/src/helpers/helpers.js index b79874a9..c335c04e 100644 --- a/client/src/helpers/helpers.js +++ b/client/src/helpers/helpers.js @@ -160,9 +160,11 @@ export const redirectToCurrentProtocol = (values) => { // TODO const redirectCheck = setInterval(() => { fetch(`https://${hostname}${httpsPort}/${hash}`, { mode: 'no-cors' }) - .then(() => { - clearInterval(redirectCheck); - window.location.replace(`https://${hostname}${httpsPort}/${hash}`); + .then((response) => { + if (response) { + clearInterval(redirectCheck); + window.location.replace(`https://${hostname}${httpsPort}/${hash}`); + } }) .catch(() => false); }, CHECK_TIMEOUT);