feat: implement hx-boost for reliable loading indication

This commit is contained in:
Björn Fromme
2025-12-07 14:11:50 +01:00
parent f0b84c9943
commit 21600dc2d6
32 changed files with 163 additions and 271 deletions
@@ -107,11 +107,11 @@ class IndexController extends AbstractController
}
/**
* Cancels the active booking session and returns to the login page.
* Cancels the active booking session and returns to the appropriate page.
*
* This endpoint allows users to exit the booking flow at any time by
* clearing the booking session data and redirecting them back to the
* regular login screen.
* clearing the booking session data and redirecting them to the account
* dashboard (if logged in) or login page (if guest).
*/
#[Route('/bookings/cancel', name: 'app_booking_cancel')]
public function cancel(Request $request): Response
@@ -127,8 +127,10 @@ class IndexController extends AbstractController
// Add a flash message to inform the user
$this->addFlash('info', 'Buchung abgebrochen.');
// Redirect to login page
return $this->hxRedirect($request, $this->generateUrl('app_login'));
// Redirect to account dashboard if logged in, otherwise to login page
$targetRoute = null !== $this->getUser() ? 'app_account' : 'app_login';
return $this->redirectToRoute($targetRoute);
}
return $this->render('booking/modal_cancel.html.twig');