diff --git a/front/views/Home.tsx b/front/views/Home.tsx
index 72643ab..de4eb87 100644
--- a/front/views/Home.tsx
+++ b/front/views/Home.tsx
@@ -44,7 +44,7 @@ export function Tactic() {
Mes stratégies
-
+
)
diff --git a/src/App/Controller/UserController.php b/src/App/Controller/UserController.php
index d0707e7..ebdb0ce 100644
--- a/src/App/Controller/UserController.php
+++ b/src/App/Controller/UserController.php
@@ -23,7 +23,23 @@ class UserController {
* @return ViewHttpResponse the home page view
*/
public function home(SessionHandle $session): ViewHttpResponse {
- return ViewHttpResponse::react("views/Home.tsx", []);
+ $lastTactic = $this->tactics->getLast(5);
+ return ViewHttpResponse::react("views/Home.tsx", $this->listTacticToJson($lastTactic));
+ }
+
+ private function listTacticToJson(array $listTactic) : array {
+ $jsonReturn = [];
+ foreach ($listTactic as $tactic){
+ //var_dump($tactic);
+ $jsonTactic = [
+ "id" => $tactic["id"],
+ "name" => $tactic["name"],
+ "creationDate" => $tactic["creation_date"]
+ ];
+ array_push($jsonReturn, $jsonTactic);
+ }
+ var_dump($jsonReturn);
+ return $jsonReturn;
}
public function homeTwig(SessionHandle $session): ViewHttpResponse {
diff --git a/src/Core/Model/TacticModel.php b/src/Core/Model/TacticModel.php
index 51e5eb8..5435922 100644
--- a/src/Core/Model/TacticModel.php
+++ b/src/Core/Model/TacticModel.php
@@ -57,6 +57,10 @@ class TacticModel {
* @param integer $nb
* @return array>
*/
+
+ /**
+ * Return the nb last tactics
+ */
public function getLast(int $nb): ?array {
return $this->tactics->getLast($nb);
}