diff --git a/core/js/dist/login.js b/core/js/dist/login.js
index c6a757adcea7d9979740f9c4c5feacb204c556c9..b999adcf754ea148951944a2279f3dad66ed8b65 100644
Binary files a/core/js/dist/login.js and b/core/js/dist/login.js differ
diff --git a/core/js/dist/login.js.map b/core/js/dist/login.js.map
index 2cb76387761d8ed271030f288ec8ba91e67341d7..01d0f442503d4ce5f8b6e1301ff73658fdba2da2 100644
Binary files a/core/js/dist/login.js.map and b/core/js/dist/login.js.map differ
diff --git a/core/js/dist/main.js b/core/js/dist/main.js
index 8c36a31859354fbb97414f7b31cf3c0fd4401ab9..d1f49927c05d9a0fd823f0ad77cce26fdf0a1d8e 100644
Binary files a/core/js/dist/main.js and b/core/js/dist/main.js differ
diff --git a/core/js/dist/main.js.map b/core/js/dist/main.js.map
index 9a375f28ec497a734774f59542ad990a2f4614e6..483de549d7d801b5e54b2024e1636cf8d4b12375 100644
Binary files a/core/js/dist/main.js.map and b/core/js/dist/main.js.map differ
diff --git a/core/js/dist/maintenance.js b/core/js/dist/maintenance.js
new file mode 100644
index 0000000000000000000000000000000000000000..4165d064952bb054bebbf899337d625ae391d0ae
Binary files /dev/null and b/core/js/dist/maintenance.js differ
diff --git a/core/js/dist/maintenance.js.map b/core/js/dist/maintenance.js.map
new file mode 100644
index 0000000000000000000000000000000000000000..bbb44dffe4a13fa535a0f6dd356e27fc27674e7e
Binary files /dev/null and b/core/js/dist/maintenance.js.map differ
diff --git a/core/js/maintenance-check.js b/core/js/maintenance-check.js
deleted file mode 100644
index b9d34793a82326745df6140237e655abaf10e8c5..0000000000000000000000000000000000000000
--- a/core/js/maintenance-check.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Check every 20 seconds via status.php if maintenance is over
-window.setInterval(checkStatus, 20000);
-
-function checkStatus() {
-	var request = new XMLHttpRequest();
-	request.open("GET", OC.getRootPath()+'/status.php', true);
-	request.onreadystatechange = function() {
-		if (request.readyState === 4) {
-			var response = request.responseText;
-			var responseobj = JSON.parse(response);
-			if (responseobj.maintenance === false) {
-				window.location.reload();
-			}
-		}
-	};
-	request.send();
-}
diff --git a/core/src/maintenance.js b/core/src/maintenance.js
new file mode 100644
index 0000000000000000000000000000000000000000..4715b65c0219006738005568de0e0e3843d8e02d
--- /dev/null
+++ b/core/src/maintenance.js
@@ -0,0 +1,49 @@
+/*
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import Axios from 'nextcloud-axios'
+
+import OC from './OC/index'
+
+const url = `${OC.getRootPath()}/status.php`
+
+const check = () => {
+	console.info('checking the Nextcloud maintenance status')
+	Axios.get(url)
+		.then(resp => resp.data)
+		.then(status => {
+			if (status.maintenance === false) {
+				console.info('Nextcloud is not in maintenance mode anymore -> reloading')
+
+				window.location.reload()
+				return
+			}
+
+			console.info('Nextcloud is still in maintenance mode')
+
+			// Wait 20sec before the next request
+			setTimeout(check, 20 * 1000);
+		})
+		.catch(console.error.bind(this))
+};
+
+// Off we go!
+check();
diff --git a/core/webpack.js b/core/webpack.js
index 2a8e9b2f0839ca0a1c56ec93b88404f45b0343d2..c40b35c9db0b84eff49e7fe03b22ec2bba402d71 100644
--- a/core/webpack.js
+++ b/core/webpack.js
@@ -5,7 +5,8 @@ module.exports = [
 	{
 		entry: {
 			login: path.join(__dirname, 'src/login.js'),
-			main: path.join(__dirname, 'src/main.js')
+			main: path.join(__dirname, 'src/main.js'),
+			maintenance: path.join(__dirname, 'src/maintenance.js'),
 		},
 		output: {
 			filename: '[name].js',
diff --git a/lib/base.php b/lib/base.php
index 735bb8b77252abcec41905ab43c8a53fdb236ab8..30d57153de986751ce86345da4f7cda65884d165 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -292,7 +292,7 @@ class OC {
 
 			// render error page
 			$template = new OC_Template('', 'update.user', 'guest');
-			OC_Util::addScript('maintenance-check');
+			OC_Util::addScript('dist/maintenance');
 			OC_Util::addStyle('core', 'guest');
 			$template->printPage();
 			die();