fixing
This commit is contained in:
parent
cd7f7aec86
commit
7e1ffe2d2f
|
|
@ -144,17 +144,30 @@ export default function ContentBlast(props: { type: string }) {
|
|||
const response = await detailMediaSummary(String(id));
|
||||
const details = response?.data?.data;
|
||||
let pageUrl = details?.pageUrl || "";
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
pageUrl = pageUrl.replace(/(\.com|\.id)(\/|$)/, "$1/in$2");
|
||||
if (pageUrl.includes("mediahub.polri.go.id")) {
|
||||
pageUrl = pageUrl.replace(
|
||||
/(\.id)(\/|$)/,
|
||||
(match: any, p1: any, p2: any) => {
|
||||
return p2.startsWith("/in") ? match : `${p1}/in${p2}`;
|
||||
}
|
||||
);
|
||||
}
|
||||
if (details != undefined) {
|
||||
form.setValue("thumbnail", details.smallThumbnailLink);
|
||||
let body = `<div><p>Berita hari ini !!!</p><div style='margin-top:20px;border:1px solid;border-radius:10px;width:500px;background-color:#f7f7f7'><div><img style='width:500px;height:auto;border-radius:10px;object-fit:cover' src='${
|
||||
details?.smallThumbnailLink
|
||||
}'></div> <a style='padding:5px 20px;margin:0;text-decoration:none' href='${pageUrl}'>${pageUrl}</a><h3 style='padding:5px 20px;margin:0'>${
|
||||
details?.title
|
||||
}</h3><p style='padding:0 20px;margin:0;margin-bottom:10px'>
|
||||
${textEllipsis(details?.description, 150)}</p></div></div>`;
|
||||
let body = `<div><p>Berita hari ini !!!</p>
|
||||
<div style='margin-top:20px;border:1px solid;border-radius:10px;width:500px;background-color:#f7f7f7'>
|
||||
<div>
|
||||
<img style='width:500px;height:auto;border-radius:10px;object-fit:cover' src='${
|
||||
details?.smallThumbnailLink
|
||||
}'>
|
||||
</div>
|
||||
<a style='padding:5px 20px;margin:0;text-decoration:none' href='${pageUrl}'>${pageUrl}</a>
|
||||
<h3 style='padding:5px 20px;margin:0'>${details?.title}</h3>
|
||||
<p style='padding:0 20px;margin:0;margin-bottom:10px'>
|
||||
${textEllipsis(details?.description, 150)}
|
||||
</p>
|
||||
</div>
|
||||
</div>`;
|
||||
form.setValue("title", `${details?.title}`);
|
||||
form.setValue(
|
||||
"url",
|
||||
|
|
|
|||
Loading…
Reference in New Issue