Add rating system for community questions

This commit is contained in:
2022-11-10 22:50:45 +01:00
parent a389d4be84
commit a269902743
4 changed files with 180 additions and 24 deletions

View File

@@ -96,14 +96,16 @@ export default {
this.$auth.currentUser.uid, // Ref: https://firebase.google.com/docs/reference/js/v8/firebase.User
Date.now() / 1000, // Current UNIX timestamp in seconds
[],
[]
{}
)
// Add a new document with a generated id.
addDoc(collection(this.$db, `kurse/${this.$store.state.selectedCourse}/fragenOffen`).withConverter(OpenEndedQuestionConverter), q)
.then((docRef) => {
// Successfully added new question to database
this.$toast({ content: 'Deine Frage wurde eingereicht!', color: 'success' })
q.id = docRef.id
this.$emit('added', q)
this.$toast({ content: 'Deine Frage wurde hinzugefügt!', color: 'success' })
})
.catch((error) => {
// Failed to add question to database; display error message
@@ -153,7 +155,7 @@ export default {
this.$auth.currentUser.uid, // Ref: https://firebase.google.com/docs/reference/js/v8/firebase.User
Date.now() / 1000, // Current UNIX timestamp in seconds
[],
[]
{}
)
const questionRef = doc(collection(this.$db, `kurse/${this.$store.state.selectedCourse}/fragenOffen`).withConverter(OpenEndedQuestionConverter))