I try to use an app_flash on my symfony app, it work everywhere but when I try to display a flash on my app_default it doesn't work. I tried to dump but it's empty like nothing is send.
I have a simple login controller to connect my users with this code:
#[Route(path: '/login', name: 'app_login')]
public function login(AuthenticationUtils $authenticationUtils): Response
{
$error = $authenticationUtils->getLastAuthenticationError();
$lastUsername = $authenticationUtils->getLastUsername();
if($lastUsername){
$this->addFlash('success', 'You are logged in.');
return $this->redirectToRoute('app_default');
}
return $this->render('pages/security/login.html.twig', [
'last_username' => $lastUsername,
'error' => $error,
]);
}
and my vue index.html.twig contains :
{% block body %}
<div class="container w-75">
{% for message in app.flashes('success') %}
<div class="alert alert-success">
{{ message }}
</div>
{% endfor %}
</div>
{% endblock %}