Add flash messages to setup.html as well

This commit is contained in:
Théophile Diot 2023-12-26 12:07:17 +00:00
parent aa9bcdc3d5
commit 9eb816ef3f
No known key found for this signature in database
GPG key ID: 248FEA4BAE400D06
2 changed files with 46 additions and 1 deletions

View file

@ -110,10 +110,11 @@
</div>
{% endfor %}
<!-- end flash message-->
{% endif %} {% endwith %}
{% endif %}
</div>
<!-- end message-->
<!-- end messages -->
</aside>
{% endwith %}
<!-- end right sidebar -->

View file

@ -1158,6 +1158,45 @@
</p>
</div>
</div>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<!-- flash messages-->
{% for category, message in messages %}
<div
role="alert"
aria-description="flash feedback message"
data-flash-message
class="{% if category == 'error' %}bg-red-500 {%else%} bg-green-500 {%endif %} p-4 mb-1 md:mb-3 md:mr-3 z-[1001] flex flex-col fixed bottom-0 right-0 w-full md:w-1/2 max-w-[300px] min-h-20 rounded-lg hover:scale-102 transition shadow-md break-words bg-clip-border"
>
<div class="flex justify-between align-top items-start">
{% if category == 'error' %}
<h5 class="text-lg mb-0 text-white">Error</h5>
{%else%}
<h5 class="text-lg mb-0 text-white">Success</h5>
{%endif%}
<button
data-close-flash-message
role="close alert message"
type="button"
class="absolute right-7 top-1.5"
>
<svg
class="cursor-pointer fill-white absolute h-5 w-5"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 320 512"
>
<path
d="M310.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L160 210.7 54.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L114.7 256 9.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 301.3 265.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L205.3 256 310.6 150.6z"
></path>
</svg>
</button>
</div>
<p class="text-white mb-0 text-sm">{{ message|safe }}</p>
</div>
{% endfor %}
<!-- end flash messages-->
{% endif %}
{% endwith %}
<!-- flash message-->
<div
role="alert"
@ -1696,8 +1735,10 @@
fetch(window.location.href, {
method: "POST",
body: new FormData(this.formEl),
redirect: "error",
})
.then((res) => {
console.log(res);
if (res.status === 200) {
setTimeout(() => {
window.open(`${api}/login`, "_self");
@ -1720,6 +1761,9 @@
this.stopLoader();
this.showErrMsg();
}, 400);
setTimeout(() => {
location.reload();
}, 2500);
});
});
}