pins logic rework
This commit is contained in:
parent
f8f285bcee
commit
1a43b0dedc
27 changed files with 300 additions and 310 deletions
|
@ -15,29 +15,19 @@ function post_toast2(url, button1, button2) {
|
|||
xhr.withCredentials=true;
|
||||
|
||||
xhr.onload = function() {
|
||||
data = JSON.parse(xhr.response)
|
||||
if (xhr.status >= 200 && xhr.status < 300 && !data["error"]) {
|
||||
try {
|
||||
document.getElementById('toast-post-success-text').innerText = data["message"];
|
||||
} catch(e) {}
|
||||
var myToast = new bootstrap.Toast(document.getElementById('toast-post-success'));
|
||||
myToast.show();
|
||||
return true
|
||||
let data = JSON.parse(xhr.response)
|
||||
if (xhr.status >= 200 && xhr.status < 300 && !data['error']) {
|
||||
document.getElementById('toast-post-success-text').innerText = data["message"];
|
||||
new bootstrap.Toast(document.getElementById('toast-post-success')).show();
|
||||
|
||||
} else if (xhr.status >= 300 && xhr.status < 400) {
|
||||
window.location.href = data["redirect"]
|
||||
document.getElementById(button1).classList.toggle("d-none");
|
||||
document.getElementById(button2).classList.toggle("d-none");
|
||||
|
||||
} else {
|
||||
try {
|
||||
document.getElementById('toast-post-error-text').innerText = data["error"];
|
||||
} catch(e) {}
|
||||
var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
|
||||
myToast.show();
|
||||
return false
|
||||
if (data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"];
|
||||
new bootstrap.Toast(document.getElementById('toast-post-error')).show();
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send(form);
|
||||
|
||||
document.getElementById(button1).classList.toggle("d-none");
|
||||
document.getElementById(button2).classList.toggle("d-none");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue