Get the username of the currently searched author correctly

This commit is contained in:
Andreas Nedbal 2023-01-28 19:18:02 +01:00
parent 8dd49d3a8c
commit 6c25594b88
1 changed files with 3 additions and 2 deletions

View File

@ -62,6 +62,7 @@ export function deleteAllQuestionsHandler(event: Event): void {
export function deleteAllAuthorQuestionsHandler(event: Event): void { export function deleteAllAuthorQuestionsHandler(event: Event): void {
const button = event.target as Element; const button = event.target as Element;
const count = button.getAttribute('data-ib-count'); const count = button.getAttribute('data-ib-count');
const urlSearchParams = new URLSearchParams(window.location.search);
swal({ swal({
title: I18n.translate('frontend.inbox.confirm_all.title', { count: count }), title: I18n.translate('frontend.inbox.confirm_all.title', { count: count }),
@ -75,7 +76,7 @@ export function deleteAllAuthorQuestionsHandler(event: Event): void {
}, (returnValue) => { }, (returnValue) => {
if (returnValue === null) return false; if (returnValue === null) return false;
post(`/ajax/delete_all_inbox/${location.pathname.split('/')[2]}`) post(`/ajax/delete_all_inbox/${urlSearchParams.get('author')}`)
.then(async response => { .then(async response => {
const data = await response.json; const data = await response.json;
@ -89,4 +90,4 @@ export function deleteAllAuthorQuestionsHandler(event: Event): void {
showErrorNotification(I18n.translate('frontend.error.message')); showErrorNotification(I18n.translate('frontend.error.message'));
}); });
}); });
} }