Skip to content

Commit

Permalink
Issue with double request
Browse files Browse the repository at this point in the history
  • Loading branch information
Rutvikrj26 committed Nov 23, 2023
1 parent 0b4d2c5 commit 38888f3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions physionet-django/events/templates/events/event_applications.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,19 @@

$form.find('input[type="submit"]').prop('disabled', false);

if ($form.attr('data-action') == 'MAKE_COHOST') {
$form.attr('data-action', 'REMOVE_COHOST');
current_action = $form.find('input[type="submit"]').attr('data-action');
make_cohost_action = '{{ cohostStatus.MAKE_COHOST }}';
remove_cohost_action = '{{ cohostStatus.REMOVE_COHOST }}';

console.log(current_action, make_cohost_action, remove_cohost_action);

if (current_action == make_cohost_action) {
$form.find('input[type="submit"]').attr('data-action', remove_cohost_action);
$form.find('input[type="submit"]').val('Remove cohost');
$form.find('input[type="submit"]').removeClass('btn-primary');
$form.find('input[type="submit"]').addClass('btn-danger');
} else if ($form.attr('data-action') == 'REMOVE_COHOST') {
$form.attr('data-action', 'MAKE_COHOST');
} else if (current_action == remove_cohost_action) {
$form.find('input[type="submit"]').attr('data-action', make_cohost_action);
$form.find('input[type="submit"]').val('Make cohost');
$form.find('input[type="submit"]').removeClass('btn-danger');
$form.find('input[type="submit"]').addClass('btn-success');
Expand Down

0 comments on commit 38888f3

Please sign in to comment.