feat: implement hx-boost for reliable loading indication
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user