From e48500b92a61eb8e97fabfc5db293462f4d7c544 Mon Sep 17 00:00:00 2001 From: Michael Foiani Date: Mon, 24 Sep 2018 17:48:24 -0400 Subject: Fixed 404 error when not signed in as admin. --- src/actions/app.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/actions/app.js b/src/actions/app.js index aecefc4..31b51a4 100644 --- a/src/actions/app.js +++ b/src/actions/app.js @@ -30,7 +30,7 @@ import {snapshotForums} from './firebaseFirestore.js'; var isSubscribedForums = false; -const loadPage = (page) => (dispatch) => { +const loadPage = (page) => (dispatch, getState) => { switch(page) { case 'home': import('../components/mao-home.js'); @@ -57,7 +57,12 @@ const loadPage = (page) => (dispatch) => { break; case 'admin': - import('../components/mao-admin.js'); + if(getState().firebaseAdmin.isAdmin) { + import('../components/mao-admin.js'); + } else { + page = 'view404'; + import('../components/my-view404.js'); + } break; default: -- cgit v1.2.3-70-g09d2