Fix: No response toast anymore. Changed bootstrap-notify with Toastify.js due to CSP restrictions.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
document.addEventListener("DOMContentLoaded", async function () {
|
||||
document.addEventListener("DOMContentLoaded", async () => {
|
||||
try {
|
||||
const response = await fetch("/api/v1/frontend/response/");
|
||||
|
||||
@@ -13,21 +13,18 @@ document.addEventListener("DOMContentLoaded", async function () {
|
||||
return;
|
||||
}
|
||||
|
||||
const title = Object.keys(data)[0];
|
||||
const messageKey = data[title];
|
||||
const type = Object.keys(data)[0];
|
||||
const messageKey = data[type];
|
||||
|
||||
$.notify({
|
||||
icon: "fa fa-bell",
|
||||
title: title.charAt(0).toUpperCase() + title.slice(1),
|
||||
message: __(messageKey)
|
||||
}, {
|
||||
type: title === "error" ? "danger" : title,
|
||||
placement: {
|
||||
from: "top",
|
||||
align: "right"
|
||||
},
|
||||
delay: 3000
|
||||
});
|
||||
Toastify({
|
||||
text: `${type.charAt(0).toUpperCase() + type.slice(1)}: ${__(messageKey)}`,
|
||||
duration: 2000,
|
||||
gravity: "top",
|
||||
position: "right",
|
||||
close: true,
|
||||
stopOnFocus: true,
|
||||
className: `toast-${type}`
|
||||
}).showToast();
|
||||
|
||||
if ($.fn.select2) {
|
||||
$("#multiple").select2({
|
||||
|
||||
Reference in New Issue
Block a user