fix: check given param is not null

This commit is contained in:
skinmaker1345 2023-09-30 23:06:51 +09:00
parent 606f3cbc82
commit 8c95cc4bb8

View File

@ -597,9 +597,11 @@ async function resetServerToken(id: string, beforeToken: string) {
return token return token
} }
async function Github(id: string, github: string) { async function Github(id: string, github: string | null) {
const user = await knex('users').where({ github }).whereNot({ id }) if(github) {
if(github && user.length !== 0) return 0 const user = await knex('users').where({ github }).whereNot({ id })
if(user.length !== 0) return 0
}
await knex('users').update({ github }).where({ id }) await knex('users').update({ github }).where({ id })
return 1 return 1
} }