Skip to content

Commit d4a072b

Browse files
author
Dan McGhan
committed
Added missing result.rowsAffected check
1 parent c045c22 commit d4a072b

File tree

1 file changed

+1
-1
lines changed
  • javascript/rest-api/part-4-handling-post-put-and-delete-requests/hr_app/db_apis

1 file changed

+1
-1
lines changed

javascript/rest-api/part-4-handling-post-put-and-delete-requests/hr_app/db_apis/employees.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ async function update(emp) {
9393
const employee = Object.assign({}, emp);
9494
const result = await database.simpleExecute(updateSql, employee);
9595

96-
if (result.rowsAffected === 1) {
96+
if (result.rowsAffected && result.rowsAffected === 1) {
9797
return employee;
9898
} else {
9999
return null;

0 commit comments

Comments
 (0)