Handling js upload files and displayling list of files by vue component.

This commit is contained in:
krzysiej
2022-06-01 14:56:56 +02:00
parent 26bd59f3bb
commit 1a5445a84a
7 changed files with 69 additions and 41 deletions

View File

@@ -14,6 +14,7 @@ use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Techtube\Bookinfo\BookFinder;
#[Route('/book')]
@@ -114,6 +115,13 @@ class BookController extends AbstractController
]);
}
#[Route('/{id}/files', name: 'app_book_file', methods: ['GET'])]
public function files(Book $book): JsonResponse
{
return $this->json($book->getFiles(), context: [AbstractNormalizer::IGNORED_ATTRIBUTES => ['book']]);
}
#[Route('/{id}/edit', name: 'app_book_edit', methods: ['GET', 'POST'])]
public function edit(
Request $request,