fix: clean error
This commit is contained in:
parent
11943b667c
commit
391fd6d380
1 changed files with 13 additions and 13 deletions
|
@ -28,22 +28,22 @@ module.exports = ({ services: { sortRolesByLevel, signJwt } }) => {
|
||||||
let deviceId
|
let deviceId
|
||||||
let roles
|
let roles
|
||||||
|
|
||||||
try {
|
const [row] = await sql`
|
||||||
const [row] = await sql`
|
SELECT
|
||||||
SELECT
|
"user_id" as "userId",
|
||||||
"user_id" as "userId",
|
"device_id" as "deviceId"
|
||||||
"device_id" as "deviceId"
|
FROM
|
||||||
FROM
|
"auth_token"
|
||||||
"auth_token"
|
WHERE
|
||||||
WHERE
|
"auth_token" = ${authToken}
|
||||||
"auth_token" = ${authToken}
|
`
|
||||||
`
|
if (!row) {
|
||||||
userId = row.userId
|
|
||||||
deviceId = row.deviceId
|
|
||||||
} catch (e) {
|
|
||||||
throw httpError(410, "Auth token not found")
|
throw httpError(410, "Auth token not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
userId = row.userId
|
||||||
|
deviceId = row.deviceId
|
||||||
|
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
await sql.begin(async (sql) => {
|
await sql.begin(async (sql) => {
|
||||||
await sql`set constraints all deferred`
|
await sql`set constraints all deferred`
|
||||||
|
|
Loading…
Add table
Reference in a new issue