Skip to content

Commit

Permalink
fix: check given param is not null
Browse files Browse the repository at this point in the history
  • Loading branch information
skinmaker1345 committed Sep 30, 2023
1 parent 606f3cb commit 8c95cc4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions utils/Query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 8c95cc4

Please sign in to comment.