Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
fix update roles
  • Loading branch information
saadshams committed Sep 5, 2024
1 parent 06605bf commit 7c28f41
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/model/ServiceProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ export class ServiceProxy extends Proxy {
try {
await this.mySQL.beginTransaction(connection);
await this.roleData.deleteRolesById(connection, id);
const payload = await this.roleData.updateRolesById(connection, id, roles);
if (roles.length > 0)
await this.roleData.updateRolesById(connection, id, roles);
await this.mySQL.commit(connection);
return payload;
return {status: 200, body: roles};
} catch (error) {
await this.mySQL.rollback(connection);
throw error;
Expand Down
1 change: 1 addition & 0 deletions src/view/components/Service.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export class Service {
}

fault(request, response, {status, body}) {
console.log(status, body);
response.writeHead(status, {"Content-Type": "application/json"});
response.end(JSON.stringify({code: status, message: body}));
}
Expand Down

0 comments on commit 7c28f41

Please # to comment.