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
}
async function Github(id: string, github: string) {
const user = await knex('users').where({ github }).whereNot({ id })
if(github && user.length !== 0) return 0
async function Github(id: string, github: string | null) {
if(github) {
const user = await knex('users').where({ github }).whereNot({ id })
if(user.length !== 0) return 0
}
await knex('users').update({ github }).where({ id })
return 1
}