Skip to content

Commit

Permalink
add clear unauthorized message for certificates and user-invitation
Browse files Browse the repository at this point in the history
  • Loading branch information
divinecharlotte committed Oct 7, 2024
1 parent fc6d7fd commit 43a6e9d
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/app/view/all-users/all-users.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ export class AllUsersComponent {
error: (err) => {
if (err.error.statusCode === 403) {
this.toastrService.error(
'Error:' + err.error.message,
'Unauthorized',
"You don't have the permissions to access the users page.",
'Access Denied',
);
} else {
this.toastrService.error('Error:' + err.error.message, 'Fail');
Expand All @@ -224,8 +224,8 @@ export class AllUsersComponent {
error: (err) => {
if (err.error.statusCode === 403) {
this.toastrService.error(
'Error:' + err.error.message,
'Unauthorized',
"You don't have the permissions to access the users page.",
'Access Denied',
);
} else {
this.toastrService.error('Error:' + err.error.message, 'Fail');
Expand All @@ -249,8 +249,8 @@ export class AllUsersComponent {
error: (err) => {
if (err.error.statusCode === 403) {
this.toastrService.error(
'Error:' + err.error.message,
'Unauthorized',
"You don't have the permissions to access the users page.",
'Access Denied',
);
} else {
this.toastrService.error('Error:' + err.error.message, 'Fail');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,10 @@ export class CertificateDetailsComponent {
this.loading = false;

if (err.error.statusCode === 403) {
this.toastrService.error('You are Unauthorized');
this.toastrService.error(
"You don't have the permissions to access the certificate page.",
'Access Denied',
);
} else {
this.toastrService.error('Error', err.error.message);
}
Expand Down
10 changes: 8 additions & 2 deletions src/app/view/device/add-bulk-device/add-bulk-device.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ export class AddBulkDeviceComponent implements OnInit {
//Error callback
console.error('error caught in component', err);
if (err.error.statusCode === 403) {
this.toastrService.error('You are Unauthorized');
this.toastrService.error(
"You don't have the permissions to add devices.",
'Access Denied',
);
} else {
this.toastrService.error('error!', err.error.message);
}
Expand All @@ -173,7 +176,10 @@ export class AddBulkDeviceComponent implements OnInit {
//Error callback
console.error('error caught in component', err);
if (err.error.statusCode === 403) {
this.toastrService.error('You are Unauthorized');
this.toastrService.error(
"You don't have the permissions to add devices.",
'Access Denied',
);
} else {
this.toastrService.error('error!', err.error.message);
}
Expand Down
5 changes: 4 additions & 1 deletion src/app/view/device/add-devices/add-devices.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,10 @@ export class AddDevicesComponent {
//Error callback
console.error('error caught in component', err.error.message);
if (err.error.statusCode === 403) {
this.toastrService.error('You are Unauthorized');
this.toastrService.error(
"You don't have the permissions to add a device.",
'Access Denied',
);
} else {
this.toastrService.error(
'some error occurred due to ' + err.error.message,
Expand Down
5 changes: 4 additions & 1 deletion src/app/view/device/alldevices/alldevices.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,10 @@ export class AlldevicesComponent {
error: (err) => {
console.log(err);
if (err.error.statusCode === 403) {
this.toastrService.error('You are Unauthorized');
this.toastrService.error(
"You don't have the permissions to access the devices.",
'Access Denied',
);
} else {
this.toastrService.error('Error', err.error.message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,11 @@ export class UserInvitationComponent {
this.getorginviteuserlist();
}
},
error: (err) => {
this.toastrService.error('Fail', err.error.message);
error: () => {
this.toastrService.error(
"You don't have the permissions to invite a user to this organization",
'Access Denied',
);
},
});
}
Expand Down

0 comments on commit 43a6e9d

Please sign in to comment.