mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 05:43:41 +00:00
[AC-2824] Refactor CLI auth-requests deny command to validate requests and improve exception handling (#9975)
This commit is contained in:
@@ -38,16 +38,18 @@ export class DenyCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.organizationAuthRequestService.denyPendingRequest(organizationId, id);
|
const pendingRequests =
|
||||||
return Response.success();
|
await this.organizationAuthRequestService.listPendingRequests(organizationId);
|
||||||
} catch (error) {
|
|
||||||
if (error?.statusCode === 404) {
|
const request = pendingRequests.find((r) => r.id == id);
|
||||||
return Response.error(
|
if (request == null) {
|
||||||
"The request id is invalid or you do not have permission to update it.",
|
return Response.error("The request id is invalid.");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Response.error(error);
|
await this.organizationAuthRequestService.denyPendingRequest(organizationId, id);
|
||||||
|
return Response.success();
|
||||||
|
} catch (e) {
|
||||||
|
return Response.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user