fix settings page delete user function

This commit is contained in:
Patrick Jentsch 2023-04-04 09:14:32 +02:00
parent ee82dafb7c
commit 477e583be9

View File

@ -125,7 +125,7 @@
{{ wtf.render_field(update_account_information_form.username, material_icon='person') }}
{{ wtf.render_field(update_account_information_form.email, material_icon='email') }}
<div class="right-align">
<a class="btn red waves-effect waves-light modal-trigger" href="#delete-user"><i class="material-icons left">delete</i>Delete</a>
<a class="btn red waves-effect waves-light modal-trigger" href="#delete-user-modal"><i class="material-icons left">delete</i>Delete</a>
{{ wtf.render_field(update_account_information_form.submit, material_icon='send') }}
</div>
</form>
@ -184,7 +184,7 @@
</div>
</div>
<div class="modal" id="delete-user">
<div class="modal" id="delete-user-modal">
<div class="modal-content">
<h4>Confirm User deletion</h4>
<p>Do you really want to delete the User <b>{{ user.username }}</b>?</p>
@ -204,7 +204,6 @@
{% block scripts %}
{{ super() }}
<script>
let deleteAvatarButtonElement = document.querySelector('#delete-avatar');
let avatarPreviewElement = document.querySelector('#update-avatar-form-avatar-preview');
let avatarUploadElement = document.querySelector('#update-avatar-form-avatar');
@ -213,7 +212,7 @@ avatarUploadElement.addEventListener('change', () => {
avatarPreviewElement.src = URL.createObjectURL(file);
});
deleteAvatarButtonElement.addEventListener('click', () => {
document.querySelector('#delete-avatar').addEventListener('click', () => {
Requests.users.entity.settings.avatar.delete({{ user.hashid|tojson }})
.then(
(response) => {