{% set flashbagSuccess = app.session.flashbag.get('success') %}
{% set flashbagError = app.session.flashbag.get('error') %}
{% set flashbagInfo = app.session.flashbag.get('info') %}
{% if flashbagSuccess is not empty or flashbagError is not empty or flashbagInfo is not empty %}
<script>
document.addEventListener('DOMContentLoaded', function () {
{% for message in flashbagSuccess %}
Swal.fire(
'Opération réussie',
"{{ message|trans }}",
'success'
);
{% endfor %}
{% for message in flashbagError %}
Swal.fire(
'Oops...',
"{{ message|trans }}",
'error'
);
{% endfor %}
{% for message in flashbagInfo %}
Swal.fire(
'Info',
"{{ message|trans }}",
'error'
);
{% endfor %}
});
</script>
{% endif %}