aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/js/app.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/js/app.js b/src/js/app.js
index 31623bb..cf2cb36 100644
--- a/src/js/app.js
+++ b/src/js/app.js
@@ -1,6 +1,10 @@
// JS Goes here - ES6 supported
-if (window.netlifyIdentity && !window.netlifyIdentity.currentUser()) {
- window.netlifyIdentity.on('login', () => {
- document.location.href = '/admin/';
+if (window.netlifyIdentity) {
+ window.netlifyIdentity.on("init", user => {
+ if (!user) {
+ window.netlifyIdentity.on("login", () => {
+ document.location.href = "/admin/";
+ });
+ }
});
}