diff options
| author | Raphael Kabo <raphaelkabo@hey.com> | 2023-10-09 17:24:09 +0100 | 
|---|---|---|
| committer | Raphael Kabo <raphaelkabo@hey.com> | 2023-10-09 17:24:09 +0100 | 
| commit | dbbb94117c2d6266cfc45a091b4b87012024f788 (patch) | |
| tree | ba8eacd0919507a874189f1091a2ec0957c39686 /views/eventgroup.handlebars | |
| parent | cc6fcb4c405d8cffacbf9b1082abf61e918482fa (diff) | |
Fix event token param bug
Diffstat (limited to 'views/eventgroup.handlebars')
| -rwxr-xr-x | views/eventgroup.handlebars | 19 | 
1 files changed, 11 insertions, 8 deletions
diff --git a/views/eventgroup.handlebars b/views/eventgroup.handlebars index 0643ed6..1d3975a 100755 --- a/views/eventgroup.handlebars +++ b/views/eventgroup.handlebars @@ -229,29 +229,30 @@ window.groupData = {{{ json jsonData }}};  <script>    $(document).ready(function() {      // Save the editing token from the URL, if it is valid -    const eventID = $('#eventName').attr('data-event-id'); +    const eventGroupID = window.groupData.id; +    const url = new URL(window.location.href);      const urlParams = new URLSearchParams(window.location.search);      if (urlParams.has('e')) {        $.ajax({          type: "POST", -        url: `/verifytoken/group/${eventID}`, +        url: `/verifytoken/group/${eventGroupID}`,          data: { editToken: urlParams.get('e') },          success: function(response, status, xhr) {            if (xhr.status === 200) { -            addStoredToken(eventID, urlParams.get('e')); +            addStoredToken(eventGroupID, urlParams.get('e'));            }          },          error: function(response, status, xhr) {            // The editing token is wrong - remove it -          removeStoredToken(eventID); +          removeStoredToken(eventGroupID);            window.location = window.location.pathname;          }        }); -    } else if (getStoredToken(eventID)) { -      const editToken = getStoredToken(eventID); +    } else if (getStoredToken(eventGroupID)) { +      const editToken = getStoredToken(eventGroupID);        $.ajax({          type: "POST", -        url: `/verifytoken/group/${eventID}`, +        url: `/verifytoken/group/${eventGroupID}`,          data: { editToken },          success: function(response, status, xhr) {            if (xhr.status === 200) { @@ -260,13 +261,15 @@ window.groupData = {{{ json jsonData }}};          },          error: function(response, status, xhr) {            // The editing token is wrong - remove it -          removeStoredToken(eventID); +          removeStoredToken(eventGroupID);          }        });      }      if (urlParams.has('show_edit')) {        $('#editModal').modal('show'); +      url.searchParams.delete('show_edit');  +      history.replaceState(history.state, '', url.href);      }      new ClipboardJS('#copyEventLink');  | 
