mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-12 12:04:16 +00:00
fix status codes
This commit is contained in:
parent
331486c871
commit
75c50204c2
@ -7,7 +7,7 @@ import jwt from "jsonwebtoken"
|
|||||||
|
|
||||||
export default async (req, res, next) => {
|
export default async (req, res, next) => {
|
||||||
function reject(description) {
|
function reject(description) {
|
||||||
return res.status(403).json({ error: `${description ?? "Invalid session"}` })
|
return res.status(401).json({ error: `${description ?? "Invalid session"}` })
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -47,7 +47,7 @@ export default async (req, res, next) => {
|
|||||||
const userData = await User.findOne({ _id: currentSession.user_id }).select("+refreshToken")
|
const userData = await User.findOne({ _id: currentSession.user_id }).select("+refreshToken")
|
||||||
|
|
||||||
if (!userData) {
|
if (!userData) {
|
||||||
return res.status(404).json({ error: "No user data found" })
|
return reject("Cannot find user")
|
||||||
}
|
}
|
||||||
|
|
||||||
// if cannot verify token, start regeneration process
|
// if cannot verify token, start regeneration process
|
||||||
|
Loading…
x
Reference in New Issue
Block a user