From 9d96ac4ae65c9fe6f5df8b5a95028495f4b00c49 Mon Sep 17 00:00:00 2001 From: Michael Foiani Date: Mon, 30 Jul 2018 17:47:26 -0400 Subject: Making big additions to backend and frontend development to fourm system. --- src/actions/app.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/actions/app.js') diff --git a/src/actions/app.js b/src/actions/app.js index 3a5f9fb..fce37d7 100644 --- a/src/actions/app.js +++ b/src/actions/app.js @@ -26,6 +26,9 @@ export const navigate = (path) => (dispatch) => { dispatch(updateDrawerState(false)); }; +import {snapshotFourms} from './firebase.js'; +var hasSubscribedPosts = false; + const loadPage = (page) => (dispatch) => { switch(page) { case 'home': @@ -41,7 +44,12 @@ const loadPage = (page) => (dispatch) => { import('../components/mao-tutoring.js'); break; case 'fourms': - import('../components/mao-fourms.js'); + import('../components/mao-fourms.js').then((module) => { + if(!hasSubscribedPosts) { + dispatch(snapshotFourms()); + hasSubscribedPosts = true; + } + });; break; case 'account': import('../components/mao-account.js'); -- cgit v1.2.3-70-g09d2