reacto: images not called directly in routes
This commit is contained in:
@@ -1,16 +1,10 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { ImageService } from "@/lib/services/image.service";
|
||||
import { BookService } from "@/lib/services/book.service";
|
||||
|
||||
export async function GET(request: NextRequest, { params }: { params: { bookId: string } }) {
|
||||
try {
|
||||
const { buffer, contentType } = await ImageService.getImage(`books/${params.bookId}/thumbnail`);
|
||||
|
||||
return new NextResponse(buffer, {
|
||||
headers: {
|
||||
"Content-Type": contentType || "image/jpeg",
|
||||
"Cache-Control": "public, max-age=31536000, immutable",
|
||||
},
|
||||
});
|
||||
const response = await BookService.getThumbnail(params.bookId);
|
||||
return response;
|
||||
} catch (error) {
|
||||
console.error("Erreur lors de la récupération de la miniature du livre:", error);
|
||||
return new NextResponse("Erreur lors de la récupération de la miniature", { status: 500 });
|
||||
|
||||
Reference in New Issue
Block a user