diff options
Diffstat (limited to 'src/components/mao-fourms.js')
| -rw-r--r-- | src/components/mao-fourms.js | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/components/mao-fourms.js b/src/components/mao-fourms.js index e7398b5..cb7095b 100644 --- a/src/components/mao-fourms.js +++ b/src/components/mao-fourms.js @@ -132,7 +132,7 @@ class MaoFourms extends connect(store)(PageViewElement) { }} _stateChanged(state) { - this.signedIn = state.firebase.signedIn; + this.signedIn = state.firebase.initialized; this.authMessage = state.firebase.authMessage; this.fourmPosts = state.firebase.fourmPosts; @@ -140,17 +140,27 @@ class MaoFourms extends connect(store)(PageViewElement) { } submitFourm() { - if( this.shadowRoot && - confirm('Are you sure you want to submit this to the fourm page? It will be public to everyone.') - ) - { + if(this.shadowRoot) { var subjectElement = this.shadowRoot.getElementById('subject-field'); var contentElement = this.shadowRoot.getElementById('content-field'); - store.dispatch(createFourmPost(subjectElement.value, contentElement.value)); + if(!contentElement.value) { + contentElement.value = ""; + } - subjectElement.value = ""; - contentElement.value = ""; + if( subjectElement.value.trim() === "" || + contentElement.value.trim() === "" + ) + { + alert("Please fill out all fields when creating a form post."); + } else { + if(confirm('Are you sure you want to submit this to the fourm page? It will be public to everyone.')) { + store.dispatch(createFourmPost(subjectElement.value, contentElement.value)); + + subjectElement.value = ""; + contentElement.value = ""; + } + } } } |
