fix: clean error

This commit is contained in:
devthejo 2025-06-30 13:47:53 +02:00
parent 11943b667c
commit 391fd6d380

View file

@ -28,7 +28,6 @@ module.exports = ({ services: { sortRolesByLevel, signJwt } }) => {
let deviceId
let roles
try {
const [row] = await sql`
SELECT
"user_id" as "userId",
@ -38,12 +37,13 @@ module.exports = ({ services: { sortRolesByLevel, signJwt } }) => {
WHERE
"auth_token" = ${authToken}
`
userId = row.userId
deviceId = row.deviceId
} catch (e) {
if (!row) {
throw httpError(410, "Auth token not found")
}
userId = row.userId
deviceId = row.deviceId
if (!userId) {
await sql.begin(async (sql) => {
await sql`set constraints all deferred`