Skip to content

Commit a4d24e5

Browse files
committed
Confirm user account
1 parent b09a87d commit a4d24e5

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

app/javascript/src/users/adminGrantPermissions.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,25 @@ $(() => {
1616
renderAlert('Unexpected error');
1717
});
1818

19+
// Confirm user account
20+
$('body').on('ajax:success', '.confirm-user', function (e) {
21+
const data = e.detail[0]; // Get data from event detail
22+
if (data.code === 1) {
23+
renderNotice(data.msg); // Function to display success message
24+
scrollTo('#notification-area');
25+
} else {
26+
renderAlert(data.msg); // Function to display failure message
27+
scrollTo('#notification-area');
28+
}
29+
// Disabling the checkbox after successful operation
30+
$(this).prop('disabled', true);
31+
});
32+
33+
$('body').on('ajax:error', '.confirm-user', function (e) {
34+
renderAlert('Unexpected error occurred while trying to confirm user.'); // Function to display error message
35+
scrollTo('#notification-area');
36+
});
37+
1938
let currentPrivileges = null;
2039
$('body').on('click', 'a[href$="admin_grant_permissions"]', (e) => {
2140
e.preventDefault();

0 commit comments

Comments
 (0)