fix: use correct return url when filtering assignments as teamer

This commit is contained in:
Björn Fromme
2024-08-23 18:22:57 +02:00
parent b6e1168a23
commit d928abae96
@@ -2,6 +2,7 @@
namespace App\Controller\Common;
use App\Controller\Traits\ReturnUrlTrait;
use App\Form\AssignmentFilterType;
use App\Htmx\HxRedirectResponse;
use App\Repository\AssignmentRepository;
@@ -14,6 +15,8 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
class AssignmentFilterController extends AbstractController
{
use ReturnUrlTrait;
public function __construct(
private readonly AssignmentFilterHandler $filterHandler,
private readonly AssignmentRepository $assignmentRepository
@@ -38,8 +41,9 @@ class AssignmentFilterController extends AbstractController
if ($form->isSubmitted() && $form->isValid()) {
$this->filterHandler->handleRequest($form);
$returnUrl = $this->getReturnUrl($request, 'app_administrative_assignment_index');
return new HxRedirectResponse($this->generateUrl('app_administrative_assignment_index'));
return new HxRedirectResponse($returnUrl);
}
return $this->render('common/modal_assignment_filter.html.twig', [
@@ -52,7 +56,8 @@ class AssignmentFilterController extends AbstractController
public function reset(Request $request): Response
{
$this->filterHandler->resetFilterSettings();
$returnUrl = $this->getReturnUrl($request, 'app_administrative_assignment_index');
return $this->redirectToRoute('app_administrative_assignment_index');
return $this->redirect($returnUrl);
}
}