Recent Posts
Please connect to internet so we can fetch forums.
`;
}
static get properties() { return {
// This is the data from the store.
signedIn: Boolean,
forumPosts: Array,
onceOnline: Boolean
}}
constructor() {
super();
this.onceOnline = false;
this.forumPosts = [];
this.signedIn = false;
}
_stateChanged(state) {
this.signedIn = state.firebaseAuth .signedIn;
this.forumPosts = state.firebaseFirestore .forumPosts;
if(this.shadowRoot) {
this.updateSection();
}
if(!state.app.offline) {
this.onceOnline = true;
}
}
_firstRendered() {
}
submitForum() {
if(this.shadowRoot) {
var subjectElement = this.shadowRoot.getElementById('subject-field');
var contentElement = this.shadowRoot.getElementById('content-field');
if(!contentElement.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 forum page? It will be public to everyone.')) {
store.dispatch(createForumPost(subjectElement.value, contentElement.value.replace('\n','