mirror of
https://github.com/anatolykopyl/vk-bingo.git
synced 2026-03-26 04:44:26 +00:00
✨ Сбор статистики
This commit is contained in:
@@ -69,6 +69,20 @@ app.get('/card', async (req, res) => {
|
||||
}
|
||||
})
|
||||
|
||||
app.post('/answer', (req, res) => {
|
||||
if (req.session.loggedIn) {
|
||||
try {
|
||||
client.db(process.env.DB_NAME).collection('anwsers').insertOne(req.body.data)
|
||||
res.status(200).send()
|
||||
} catch (e) {
|
||||
console.log("Error: " + e)
|
||||
res.status(500).send()
|
||||
}
|
||||
} else {
|
||||
res.status(403).send()
|
||||
}
|
||||
})
|
||||
|
||||
app.get('/options', async (req, res) => {
|
||||
if (req.session.loggedIn) {
|
||||
res.status(200).send(names)
|
||||
|
||||
@@ -63,6 +63,13 @@ export default {
|
||||
setTimeout(function() {
|
||||
innerThis.showResult = true
|
||||
}, 800)
|
||||
axios
|
||||
.post(process.env.VUE_APP_BACKEND + '/answer', {
|
||||
'data': {
|
||||
'correct': this.correctAnswer,
|
||||
'selected': this.selectedAnswer
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
Reference in New Issue
Block a user