forked from rDrama/rDrama
better error message
parent
6472a517cc
commit
1b7c1e51c6
|
@ -1,7 +1,7 @@
|
||||||
const SITE_FULL_IMAGES = document.getElementById('SITE_FULL_IMAGES').value
|
const SITE_FULL_IMAGES = document.getElementById('SITE_FULL_IMAGES').value
|
||||||
|
|
||||||
function getMessageFromJsonData(success, json) {
|
function getMessageFromJsonData(success, json) {
|
||||||
let message = success ? "Success!" : "Error, please try again later";
|
let message = success ? "Success!" : "Error, please refresh the page and try again";
|
||||||
let key = success ? "message" : "error";
|
let key = success ? "message" : "error";
|
||||||
if (!json || !json[key]) return message;
|
if (!json || !json[key]) return message;
|
||||||
message = json[key];
|
message = json[key];
|
||||||
|
@ -17,7 +17,7 @@ function showToast(success, message) {
|
||||||
let element = success ? "toast-post-success" : "toast-post-error";
|
let element = success ? "toast-post-success" : "toast-post-error";
|
||||||
let textElement = element + "-text";
|
let textElement = element + "-text";
|
||||||
if (!message) {
|
if (!message) {
|
||||||
message = success ? "Action successful!" : "Error, please try again later";
|
message = success ? "Action successful!" : "Error, please refresh the page and try again";
|
||||||
}
|
}
|
||||||
document.getElementById(textElement).textContent = message;
|
document.getElementById(textElement).textContent = message;
|
||||||
bootstrap.Toast.getOrCreateInstance(document.getElementById(element)).show();
|
bootstrap.Toast.getOrCreateInstance(document.getElementById(element)).show();
|
||||||
|
|
|
@ -87,7 +87,7 @@ function handleLotteryResponse(xhr, method, callback) {
|
||||||
const toastMessage = document.getElementById("lottery-post-error-text");
|
const toastMessage = document.getElementById("lottery-post-error-text");
|
||||||
|
|
||||||
toastMessage.textContent =
|
toastMessage.textContent =
|
||||||
(response && response.details) || "Error, please try again later.";
|
(response && response.details) || "Error, please refresh the page and try again.";
|
||||||
|
|
||||||
bootstrap.Toast.getOrCreateInstance(toast).show();
|
bootstrap.Toast.getOrCreateInstance(toast).show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,7 +192,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="toast" id="toast-post-error" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 10000000000" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
|
<div class="toast" id="toast-post-error" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 10000000000" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
|
||||||
<div class="toast-body bg-danger text-center text-white">
|
<div class="toast-body bg-danger text-center text-white">
|
||||||
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text">Error, please try again later.</span>
|
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text">Error, please refresh the page and try again.</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script defer="" src="/assets/js/vendor/lozad.js?x=f404b566"></script>
|
<script defer="" src="/assets/js/vendor/lozad.js?x=f404b566"></script>
|
||||||
|
|
|
@ -194,7 +194,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="toast" id="toast-post-error" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 10000000000" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
|
<div class="toast" id="toast-post-error" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 10000000000" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
|
||||||
<div class="toast-body bg-danger text-center text-white">
|
<div class="toast-body bg-danger text-center text-white">
|
||||||
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text">Error, please try again later.</span>
|
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text">Error, please refresh the page and try again.</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script defer="" src="/assets/js/vendor/lozad.js?x=f404b566"></script>
|
<script defer="" src="/assets/js/vendor/lozad.js?x=f404b566"></script>
|
||||||
|
|
|
@ -193,7 +193,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="toast" id="toast-post-error" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 10000000000" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
|
<div class="toast" id="toast-post-error" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 10000000000" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
|
||||||
<div class="toast-body bg-danger text-center text-white">
|
<div class="toast-body bg-danger text-center text-white">
|
||||||
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text">Error, please try again later.</span>
|
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text">Error, please refresh the page and try again.</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script defer="" src="/assets/js/vendor/lozad.js?x=f404b566"></script>
|
<script defer="" src="/assets/js/vendor/lozad.js?x=f404b566"></script>
|
||||||
|
|
|
@ -195,7 +195,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="toast" id="toast-post-error" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 10000000000" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
|
<div class="toast" id="toast-post-error" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 10000000000" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
|
||||||
<div class="toast-body bg-danger text-center text-white">
|
<div class="toast-body bg-danger text-center text-white">
|
||||||
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text">Error, please try again later.</span>
|
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text">Error, please refresh the page and try again.</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script defer="" src="/assets/js/vendor/lozad.js?x=f404b566"></script>
|
<script defer="" src="/assets/js/vendor/lozad.js?x=f404b566"></script>
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="toast" id="toast-post-error" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 10000000000" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
|
<div class="toast" id="toast-post-error" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 10000000000" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
|
||||||
<div class="toast-body bg-danger text-center text-white">
|
<div class="toast-body bg-danger text-center text-white">
|
||||||
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text">Error, please try again later.</span>
|
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text">Error, please refresh the page and try again.</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue