From 5f5fdd5d2ec5a6672c7c944df24d021ad1a6501b Mon Sep 17 00:00:00 2001 From: Eric Jinks Date: Tue, 27 Mar 2018 15:20:41 +1000 Subject: [PATCH] Move Netlify Identity to script src --- public/index.html | 13 +++++++++++++ src/index.js | 1 - src/netlifyIdentity.js | 15 --------------- 3 files changed, 13 insertions(+), 16 deletions(-) delete mode 100644 src/netlifyIdentity.js diff --git a/public/index.html b/public/index.html index 58d50dd..2327328 100644 --- a/public/index.html +++ b/public/index.html @@ -29,5 +29,18 @@ To begin the development, run `npm start`. To create a production bundle, use `npm run build`. --> + + diff --git a/src/index.js b/src/index.js index ee85c65..9ac5ce5 100644 --- a/src/index.js +++ b/src/index.js @@ -3,7 +3,6 @@ import React from 'react' import { render } from 'react-snapshot' import App from './App' import registerServiceWorker from './registerServiceWorker' -import './netlifyIdentity' import 'normalize.css' import './globalStyles.css' diff --git a/src/netlifyIdentity.js b/src/netlifyIdentity.js deleted file mode 100644 index bcb8bb0..0000000 --- a/src/netlifyIdentity.js +++ /dev/null @@ -1,15 +0,0 @@ -import netlifyIdentity from 'netlify-identity-widget' - -// check for netlifyIdentity, redirect to admin if user is logging in -netlifyIdentity.on('init', user => { - if (!user) { - netlifyIdentity.on('login', () => { - document.location.href = '/admin/' - }) - } -}) - -if (window.localStorage) { - netlifyIdentity.init() - window.netlifyIdentity = netlifyIdentity -}