Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/user_accounts/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
js/*
!js/edit_user_helper.js
!js/edit_user_helper.js
17 changes: 0 additions & 17 deletions modules/user_accounts/js/rejectUser.js

This file was deleted.

46 changes: 46 additions & 0 deletions modules/user_accounts/jsx/rejectUser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import swal from 'sweetalert2';

window.addEventListener('load', () => {
const btn = document.getElementById('btn_reject');

if (!btn) return;

btn.addEventListener('click', () => {
const userID = document.getElementById('UserID').value;
const baseurl = loris.BaseURL;

swal.fire({
title: 'Are you sure?',
text: `Do you really want to reject user "${userID}"?\n` +
'This action cannot be undone.',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Yes, reject user!',
cancelButtonText: 'Cancel',
}).then((result) => {
if (result.isConfirmed) {
fetch(`${baseurl}/user_accounts/ajax/rejectUser.php`, {
method: 'POST',
credentials: 'same-origin',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({
identifier: userID,
}),
})
.then((resp) => {
if (!resp.ok) {
return resp.text().then((text) => {
throw new Error(text);
});
}
window.location.href = `${baseurl}/user_accounts/`;
})
.catch((error) => {
swal.fire('Error', error.message, 'error');
});
}
});
});
});
2 changes: 1 addition & 1 deletion webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ let lorisModules: { [x: string]: string[] } = {
instrument_manager: ['instrumentManagerIndex'],
survey_accounts: ['surveyAccountsIndex'],
mri_violations: ['mriViolationsIndex'],
user_accounts: ['userAccountsIndex'],
user_accounts: ['userAccountsIndex', 'rejectUser'],
examiner: ['examinerIndex'],
help_editor: ['help_editor', 'helpEditorForm'],
brainbrowser: ['Brainbrowser'],
Expand Down
Loading