This commit is contained in:
Anang Yusman 2025-09-23 16:27:41 +08:00
parent deee3aecb9
commit 7768cff6af
15 changed files with 41 additions and 37 deletions

View File

@ -21,7 +21,7 @@ type Article = {
title: string;
}[];
files: {
file_url: string;
fileUrl: string;
file_alt: string;
}[];
};
@ -206,9 +206,9 @@ export default function DetailContent() {
</div>
<div className="w-full h-auto mb-6">
{articleDetail?.files?.[0]?.file_url ? (
{articleDetail?.files?.[0]?.fileUrl ? (
<Image
src={articleDetail.files[0].file_url}
src={articleDetail.files[0].fileUrl}
alt="Berita"
width={800}
height={400}

View File

@ -614,9 +614,7 @@ export default function EditArticleForm(props: { isDetail: boolean }) {
alt="main"
width={720}
height={480}
src={
detailfiles[mainImage]?.file_url || "/default-avatar.png"
}
src={detailfiles[mainImage]?.fileUrl || "/default-avatar.png"}
className="w-[75%] mx-auto"
/>
</div>
@ -631,7 +629,7 @@ export default function EditArticleForm(props: { isDetail: boolean }) {
width={480}
height={360}
alt={`image-${index}`}
src={file.file_url || "/default-avatar.png"}
src={file.fileUrl || "/default-avatar.png"}
className="h-[100px] object-cover w-[150px]"
/>
</a>
@ -654,7 +652,7 @@ export default function EditArticleForm(props: { isDetail: boolean }) {
width={480}
height={360}
alt={`image-${index}`}
src={file?.file_url || "/default-avatar.png"}
src={file?.fileUrl || "/default-avatar.png"}
className="h-[100px] object-cover w-[150px]"
/>
</div>

View File

@ -196,16 +196,14 @@ export default function Login() {
<Link href={"/"}>
<div className="pl-16 bg-white rounded-md">
<img
src="/kebaikan-indonesia.png"
src="/harapan.png"
alt="Mikul News Logo"
className="w-[400px] h-auto "
/>
</div>
</Link>
<div className="mt-8 text-white/90">
<h2 className="text-2xl font-bold mb-2">
Portal Kebaikan Indonesia
</h2>
<h2 className="text-2xl font-bold mb-2">Portal Kabar Harapan</h2>
<p className="text-sm opacity-80">
Platform berita terpercaya untuk informasi terkini
</p>
@ -428,7 +426,7 @@ export default function Login() {
Selamat Datang
</h2>
<p className="text-gray-600">
Portal Kebaikan Indonesia- Platform berita terpercaya
Portal Kabar Harapan- Platform berita terpercaya
</p>
</div>

View File

@ -11,7 +11,7 @@ type Article = {
createdByName: string;
thumbnailUrl: string;
categories: { title: string }[];
files: { file_url: string; file_alt: string }[];
files: { fileUrl: string; file_alt: string }[];
};
export default function BannerNews() {
@ -51,7 +51,7 @@ export default function BannerNews() {
{/* Artikel utama */}
<div className="lg:col-span-2 relative">
<img
src={mainArticle.thumbnailUrl || mainArticle.files?.[0]?.file_url}
src={mainArticle.thumbnailUrl || mainArticle.files?.[0]?.fileUrl}
alt={mainArticle.files?.[0]?.file_alt || mainArticle.title}
className="w-full h-[400px] object-cover rounded-lg"
/>
@ -70,7 +70,7 @@ export default function BannerNews() {
{sideArticles.map((article) => (
<div key={article.id} className="relative">
<img
src={article.thumbnailUrl || article.files?.[0]?.file_url}
src={article.thumbnailUrl || article.files?.[0]?.fileUrl}
alt={article.files?.[0]?.file_alt || article.title}
className="w-full h-[125px] object-cover rounded-lg"
/>

View File

@ -15,7 +15,7 @@ type Article = {
createdByName: string;
thumbnailUrl: string;
categories: { title: string }[];
files: { file_url: string; file_alt: string }[];
files: { fileUrl: string; file_alt: string }[];
};
type PaginationMeta = {
@ -82,7 +82,7 @@ export default function BreakingNews() {
<Image
src={
article.thumbnailUrl ||
article.files?.[0]?.file_url ||
article.files?.[0]?.fileUrl ||
"/placeholder.jpg"
}
alt={article.files?.[0]?.file_alt || article.title}

View File

@ -16,7 +16,7 @@ type Article = {
title: string;
}[];
files: {
file_url: string;
fileUrl: string;
file_alt: string;
}[];
};
@ -149,7 +149,7 @@ export default function News() {
{/* Item pertama tampil besar */}
<div className="relative">
<Image
src={popular[0]?.files?.[0]?.file_url || "/dummy.jpg"}
src={popular[0]?.files?.[0]?.fileUrl || "/dummy.jpg"}
alt={
popular[0]?.files?.[0]?.file_alt ||
popular[0]?.title ||

View File

@ -14,7 +14,7 @@ type Article = {
createdByName: string;
thumbnailUrl: string;
categories: { title: string }[];
files: { file_url: string; file_alt: string }[];
files: { fileUrl: string; file_alt: string }[];
};
export default function HeaderPopular() {

View File

@ -15,7 +15,7 @@ type Article = {
createdByName: string;
thumbnailUrl: string;
categories: { title: string }[];
files: { file_url: string; file_alt: string }[];
files: { fileUrl: string; file_alt: string }[];
};
export default function Header() {

View File

@ -12,7 +12,7 @@ type Article = {
createdByName: string;
thumbnailUrl: string;
categories: { title: string }[];
files: { file_url: string; file_alt: string }[];
files: { fileUrl: string; file_alt: string }[];
};
export default function LatestNews() {

View File

@ -13,7 +13,7 @@ type Article = {
createdByName: string;
thumbnailUrl: string;
categories: { title: string }[];
files: { file_url: string; file_alt: string }[];
files: { fileUrl: string; file_alt: string }[];
};
export default function News() {
@ -134,7 +134,7 @@ function PostItem({ post }: { post: Article }) {
<div className="relative w-40 h-28 flex-shrink-0">
<Image
src={
post.thumbnailUrl || post.files?.[0]?.file_url || "/placeholder.jpg"
post.thumbnailUrl || post.files?.[0]?.fileUrl || "/placeholder.jpg"
}
alt={post.files?.[0]?.file_alt || post.title}
fill

View File

@ -211,7 +211,7 @@ const SidebarContent = ({
<Link href="/" className="flex items-center space-x-3">
<div className="relative">
<img
src="/kebaikan-indonesia.png"
src="/harapan.png"
className="w-10 h-10 rounded-lg shadow-sm"
/>
<div className="absolute -inset-1 bg-gradient-to-r from-blue-500 to-purple-500 rounded-lg opacity-20 blur-sm"></div>
@ -224,7 +224,7 @@ const SidebarContent = ({
className="flex flex-col"
>
<span className="text-sm font-bold bg-gradient-to-r from-slate-800 to-slate-600 bg-clip-text text-transparent">
Kebaikan Indonesia
Kabar Harapan
</span>
<span className="text-xs text-slate-500">Admin Panel</span>
</motion.div>

View File

@ -6,7 +6,7 @@ const axiosBaseInstance = axios.create({
baseURL,
headers: {
"Content-Type": "application/json",
"X-Client-Key": "bb65b1ad-e954-4a1a-b4d0-74df5bb0b640"
"X-Client-Key": "f5a4ef1b-53ba-48df-9520-4c105dbec533",
},
});

View File

@ -10,7 +10,7 @@ const axiosInterceptorInstance = axios.create({
baseURL,
headers: {
"Content-Type": "application/json",
"X-Client-Key": "bb65b1ad-e954-4a1a-b4d0-74df5bb0b640"
"X-Client-Key": "f5a4ef1b-53ba-48df-9520-4c105dbec533",
},
withCredentials: true,
});

View File

@ -2,11 +2,11 @@ import axiosBaseInstance from "./axios-base-instance";
const defaultHeaders = {
"Content-Type": "application/json",
"X-Client-Key": "bb65b1ad-e954-4a1a-b4d0-74df5bb0b640"
"X-Client-Key": "f5a4ef1b-53ba-48df-9520-4c105dbec533",
};
export async function httpGet(pathUrl: any, headers?: any) {
console.log("X-HEADERS : ", defaultHeaders)
export async function httpGet(pathUrl: any, headers?: any) {
console.log("X-HEADERS : ", defaultHeaders);
const mergedHeaders = {
...defaultHeaders,
...headers,

View File

@ -5,11 +5,11 @@ import { getCsrfToken } from "../master-user";
const defaultHeaders = {
"Content-Type": "application/json",
"X-Client-Key": "bb65b1ad-e954-4a1a-b4d0-74df5bb0b640"
"X-Client-Key": "f5a4ef1b-53ba-48df-9520-4c105dbec533",
};
export async function httpGetInterceptor(pathUrl: any) {
console.log("X-HEADERS : ", defaultHeaders)
console.log("X-HEADERS : ", defaultHeaders);
const response = await axiosInterceptorInstance
.get(pathUrl, { headers: defaultHeaders })
.catch((error) => error.response);
@ -35,7 +35,11 @@ export async function httpGetInterceptor(pathUrl: any) {
}
}
export async function httpPostInterceptor(pathUrl: any, data: any, headers?: any) {
export async function httpPostInterceptor(
pathUrl: any,
data: any,
headers?: any
) {
const resCsrf = await getCsrfToken();
const csrfToken = resCsrf?.data?.csrf_token;
@ -67,7 +71,11 @@ export async function httpPostInterceptor(pathUrl: any, data: any, headers?: any
}
}
export async function httpPutInterceptor(pathUrl: any, data: any, headers?: any) {
export async function httpPutInterceptor(
pathUrl: any,
data: any,
headers?: any
) {
const resCsrf = await getCsrfToken();
const csrfToken = resCsrf?.data?.csrf_token;
@ -99,7 +107,7 @@ export async function httpPutInterceptor(pathUrl: any, data: any, headers?: any)
}
export async function httpDeleteInterceptor(pathUrl: any, headers?: any) {
const resCsrf = await getCsrfToken();
const resCsrf = await getCsrfToken();
const csrfToken = resCsrf?.data?.csrf_token;
const mergedHeaders = {