Skip to content

Commit

Permalink
fix inspection redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBadura committed Jan 28, 2024
1 parent ff419ef commit 639c6cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/Controller/InspectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,18 @@ public function __construct(
public function indexAction(Request $request): Response
{
if ($request->getMethod() === 'POST') {
$aggregateName = $request->request->get('aggregateName');
$aggregateId = $request->request->get('aggregateId');

$aggregateName = $request->get('aggregate');
$aggregateId = $request->get('aggregateId');

if ($aggregateName === null || $aggregateId === null) {
throw new NotFoundHttpException('aggregateName and aggregateId are required');
}

return new RedirectResponse(
$this->router->generate('patchlevel_event_sourcing_admin_inspection_show', [
'aggregateName' => $request->request->get('aggregateName'),
'aggregateId' => $request->request->get('aggregateId'),
'aggregateName' => $aggregateName,
'aggregateId' => $aggregateId,
]),
);
}
Expand Down
4 changes: 2 additions & 2 deletions templates/inspection/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<form method="post" class="flex gap-2 items-end" action="{{ path('patchlevel_event_sourcing_admin_inspection_index') }}">
<div class="w-48">
<label for="aggregate" class="block text-xs font-medium leading-6 text-gray-900">Aggregate</label>
<select id="aggregate" name="aggregate"
<select required id="aggregate" name="aggregate"
class="mt-1 block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6">
<option {% if app.request.get('aggregate') == "" %}selected{% endif %}
value="">-- choose --
Expand All @@ -28,7 +28,7 @@
<label for="aggregateId" class="block text-xs font-medium leading-6 text-gray-900">Aggregate
ID</label>
<div class="mt-1">
<input type="text" name="aggregateId" id="aggregateId"
<input type="text" name="aggregateId" id="aggregateId" required
class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
placeholder="018d233e-7906-73f1-8a0c-f76a4fdac34e"
value="{{ app.request.get('aggregateId') }}">
Expand Down

0 comments on commit 639c6cb

Please sign in to comment.