Save record on server
This commit is contained in:
parent
a38072214e
commit
a575d447f9
9 changed files with 68 additions and 36 deletions
|
|
@ -7,7 +7,7 @@ import cors from 'cors'
|
|||
|
||||
import auth from './Auth.js'
|
||||
import db from './Database.js'
|
||||
import jg from './JusticeGuard'
|
||||
import jg from './JusticeGuard.js'
|
||||
|
||||
const protect = (req, res, next) => {
|
||||
const authHeader = req.headers.authorization;
|
||||
|
|
@ -76,7 +76,7 @@ app.post("/login", neededArguments(['key']), async (req, res) => {
|
|||
res.json(user)
|
||||
})
|
||||
|
||||
app.post("/record", neededArguments(['points', 'shoots', 'time']), jg, async (req, res) => {
|
||||
app.post("/record", protect, neededArguments(['points', 'shoots', 'time']), jg, async (req, res) => {
|
||||
db.updateRecord(req.user.name, req.body.points)
|
||||
|
||||
res.json({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue