fix magazine

This commit is contained in:
Rama Priyanto 2025-02-07 10:06:38 +07:00
parent 34311f2fc4
commit d110f85e30
2 changed files with 10 additions and 8 deletions

View File

@ -70,7 +70,11 @@ export default function ENewsPolri() {
<Card isFooterBlurred radius="lg" className="border-none"> <Card isFooterBlurred radius="lg" className="border-none">
<img <img
alt="thumbnail" alt="thumbnail"
src={newsItem?.thumbnailUrl ? "" : "/no-image.jpg"} src={
newsItem?.thumbnailUrl
? newsItem?.thumbnailUrl
: "/no-image.jpg"
}
className="!h-[25vh] object-cover rounded-none" className="!h-[25vh] object-cover rounded-none"
/> />
<CardFooter className="before:bg-white/10 border-white/20 border-1 overflow-hidden py-1 md:absolute bottom-1 shadow-small z-10"> <CardFooter className="before:bg-white/10 border-white/20 border-1 overflow-hidden py-1 md:absolute bottom-1 shadow-small z-10">
@ -81,7 +85,6 @@ export default function ENewsPolri() {
</p> </p>
</Link> </Link>
<div className="flex flex-row gap-1"> <div className="flex flex-row gap-1">
{" "}
<p className="py-[2px] text-left text-xs"> <p className="py-[2px] text-left text-xs">
{convertDateFormat(newsItem.createdAt)} WIB {convertDateFormat(newsItem.createdAt)} WIB
</p> </p>

View File

@ -1,5 +1,6 @@
"use client"; "use client";
import { ChevronRightIcon } from "@/components/icons"; import { ChevronRightIcon } from "@/components/icons";
import { close, loading } from "@/config/swal";
import { getMagazineById } from "@/service/magazine"; import { getMagazineById } from "@/service/magazine";
import { import {
convertDateFormat, convertDateFormat,
@ -24,16 +25,18 @@ export default function EMagazineDetail() {
}, [id]); }, [id]);
const initFetch = async () => { const initFetch = async () => {
loading();
const res = await getMagazineById(String(id)); const res = await getMagazineById(String(id));
const data = res?.data?.data; const data = res?.data?.data;
setDetailData(data); setDetailData(data);
setDetailFiles(data?.files); setDetailFiles(data?.files);
close();
}; };
const doDownload = async (fileName: string, title: string): Promise<void> => { const doDownload = async (fileName: string, title: string): Promise<void> => {
try { try {
const response = await fetch( const response = await fetch(
`https://38.47.180.165:8802/magazine-files/viewer/${fileName}` `https://kontenhumas.com/magazine-files/viewer/${fileName}`
); );
if (!response.ok) { if (!response.ok) {
@ -80,11 +83,7 @@ export default function EMagazineDetail() {
className="h-[380px] rounded-md py-1" className="h-[380px] rounded-md py-1"
/> */} /> */}
<img <img
src={`https://kontenhumas.com/magazines/thumbnail/viewer/${ src={detailData?.thumbnailUrl}
detailData?.thumbnailPath.split("/")[
detailData?.thumbnailPath.split("/").length - 1
]
}`}
alt="emagazine" alt="emagazine"
className="h-[380px] rounded-md py-1" className="h-[380px] rounded-md py-1"
/> />