Add cookie storage for lastImage in favico API GET route

This commit is contained in:
m4x809 2025-10-25 14:14:08 +02:00
parent 688255f8bd
commit f87e1ba9c3
Signed by: m4x809
SSH key fingerprint: SHA256:YCoFF78p2DUP94EnCScqLwldjkKDwdKSZq3r8p/6EiU

View file

@ -26,6 +26,8 @@ export async function GET(request: NextRequest) {
} }
const album = availableAlbums[randomIndex]; const album = availableAlbums[randomIndex];
console.log("🚀 ~ route.tsx:25 ~ GET ~ album:", album); console.log("🚀 ~ route.tsx:25 ~ GET ~ album:", album);
cookieStore.set("lastImage", album.image);
// Ensure image path starts with a slash // Ensure image path starts with a slash
const imagePath = album.image.startsWith("/") ? album.image : `/${album.image}`; const imagePath = album.image.startsWith("/") ? album.image : `/${album.image}`;
console.log("🚀 ~ route.tsx:29 ~ GET ~ imagePath:", imagePath); console.log("🚀 ~ route.tsx:29 ~ GET ~ imagePath:", imagePath);