remove duplicated code

master
Aevann 2023-02-17 19:20:07 +02:00
parent 52907b4a2e
commit 7cd1b2a83f
2 changed files with 4 additions and 8 deletions

View File

@ -363,13 +363,7 @@ def get_profile_picture(identifier:Union[int, str]) -> str:
return x.profile_url if x else 'not_found'
def get_error():
if request.referrer and request.referrer.split('?')[0] == request.base_url:
return request.values.get("error")
else:
return None
return request.values.get("error")
def get_msg():
if request.referrer and request.referrer.split('?')[0] == request.base_url:
return request.values.get("msg")
else:
return None
return request.values.get("msg")

View File

@ -185,6 +185,7 @@
{% endmacro %}
{% macro alert(msg, error=false) %}
{% if request.referrer and request.referrer.split('?')[0] == request.base_url %}
<div class="alert {% if error %}alert-danger{% else %}alert-success{% endif %} alert-dismissible fade show mb-3 mt-4">
<i class="fas {% if error %}fa-exclamation-circle{% else %}fa-check-circle{% endif %} my-auto"></i>
<span>{{msg}}</span>
@ -192,4 +193,5 @@
<span><i class="far fa-times"></i></span>
</button>
</div>
{% endif %}
{% endmacro %}