fix toast message issue on pages with query params

This commit is contained in:
RaidMax 2022-06-28 10:03:05 -05:00
parent 5a2ee36df9
commit e07651b931

View File

@ -57,6 +57,15 @@ function escapeHtml (string) {
});
}
function buildToastUri(message, duration) {
let uri = '&';
if (window.location.href.toString().indexOf('?') <= 0) {
uri = '?';
}
uri += `toastMessage=${escape(message)}${duration ? `&duration=${duration}` : ''}`;
return uri;
}
$(document).ready(function () {
let toastMessage = getUrlParameter('toastMessage');
@ -130,7 +139,7 @@ $(document).ready(function () {
}
catch{}
if (shouldRefresh) {
window.location = `${window.location.href.replace('#', '')}?toastMessage=${escape(message)}${duration ? `&duration=${duration}` : ''}`;
window.location = `${window.location.href.replace('#', '')}${buildToastUri(message, duration)}`;
}
else {
modal.modal();