forked from rDrama/rDrama
use showToast in some areas where we weren't before
parent
3c3950adb0
commit
5f16356d7a
|
@ -1,6 +1,5 @@
|
||||||
function poll_vote_no_v() {
|
function poll_vote_no_v() {
|
||||||
document.getElementById('toast-post-error-text').innerText = "Only logged-in users can vote!";
|
showToast(false, "Only logged-in users can vote!");
|
||||||
bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error')).show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function expandMarkdown(id,type) {
|
function expandMarkdown(id,type) {
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
function block_user() {
|
function block_user() {
|
||||||
|
|
||||||
var usernameField = document.getElementById("exile-username");
|
var usernameField = document.getElementById("exile-username");
|
||||||
|
|
||||||
var isValidUsername = usernameField.checkValidity();
|
var isValidUsername = usernameField.checkValidity();
|
||||||
|
|
||||||
username = usernameField.value;
|
username = usernameField.value;
|
||||||
|
|
||||||
if (isValidUsername) {
|
if (isValidUsername) {
|
||||||
|
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
xhr.open("post", "/settings/block");
|
xhr.open("post", "/settings/block");
|
||||||
xhr.setRequestHeader('xhr', 'xhr');
|
xhr.setRequestHeader('xhr', 'xhr');
|
||||||
|
@ -19,11 +14,7 @@ function block_user() {
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success'));
|
showToast(false, "Error, please try again later.");
|
||||||
myToast.hide();
|
|
||||||
var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error'));
|
|
||||||
myToast.show();
|
|
||||||
document.getElementById("toast-error-message").textContent = "Error. Please try again later.";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xhr.send(f)
|
xhr.send(f)
|
||||||
|
|
Loading…
Reference in New Issue