#50 [card] pronoun cards - api fixes

This commit is contained in:
Avris 2020-10-16 23:46:49 +02:00
parent 08f3f2a649
commit 3bbe77f5f0
1 changed files with 3 additions and 3 deletions

View File

@ -166,15 +166,15 @@ export default async function (req, res, next) {
const user = authenticate(req); const user = authenticate(req);
if (req.method === 'POST' && req.url === '/init' && req.body.usernameOrEmail) { if (req.method === 'POST' && req.url === '/init' && req.body.usernameOrEmail) {
return renderJson(await init(db, req.body.usernameOrEmail)); return renderJson(res, await init(db, req.body.usernameOrEmail));
} }
if (req.method === 'POST' && req.url === '/validate' && req.body.code) { if (req.method === 'POST' && req.url === '/validate' && req.body.code) {
return renderJson(await validate(db, user, req.body.code)); return renderJson(res, await validate(db, user, req.body.code));
} }
if (req.method === 'POST' && req.url === '/change-username' && user && user.authenticated && req.body.username) { if (req.method === 'POST' && req.url === '/change-username' && user && user.authenticated && req.body.username) {
return renderJson(await changeUsername(db, user, req.body.username)); return renderJson(res, await changeUsername(db, user, req.body.username));
} }
return renderJson(res, {error: 'Not found'}, 404); return renderJson(res, {error: 'Not found'}, 404);