79100854

Date: 2024-10-18 06:54:00
Score: 1
Natty:
Report link
async function changePw(id: string, hash: string) {
    try {
        const [result] = await pool.execute('UPDATE User SET password_hash = ? WHERE id = ?',
            [
                hash,
                id
            ])
        const resObj = JSON.parse(JSON.stringify(result))
        if( resObj.affectedRows ) return 'success'
        else return 'fail'
    } catch (e) {
        console.log('userCalls.changePw error', e)
    }
}

https://sidorares.github.io/node-mysql2/docs/examples/queries/simple-queries/update#querysql

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: wkille