Przeglądaj źródła

Add 403 status, change typo of async to await

sbkwgh 8 lat temu
rodzic
commit
dbb31724c7
1 zmienionych plików z 2 dodań i 1 usunięć
  1. 2 1
      routes/user.js

+ 2 - 1
routes/user.js

@@ -73,7 +73,7 @@ router.get('/:username', async (req, res) => {
 			throw Errors.requestNotAuthorized
 		}
 
-		let user = async User.findOne({
+		let user = await User.findOne({
 			attributes: { exclude: ['hash', 'id'] },
 			where: { username: req.params.username }
 		})
@@ -81,6 +81,7 @@ router.get('/:username', async (req, res) => {
 		res.json(user.toJSON())
 	} catch (err) {
 		if(err === Errors.requestNotAuthorized) {
+			res.status(403)
 			res.json({
 				errors: [Errors.requestNotAuthorized]
 			})