This commit is contained in:
Anang Yusman 2025-09-23 17:11:40 +08:00
parent d3d831d7ac
commit f3b400c38a
11 changed files with 29 additions and 23 deletions

View File

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

View File

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

View File

@ -16,7 +16,7 @@ type Article = {
title: string; title: string;
}[]; }[];
files: { files: {
file_url: string; fileUrl: string;
file_alt: string; file_alt: string;
}[]; }[];
}; };

View File

@ -16,7 +16,7 @@ type Article = {
title: string; title: string;
}[]; }[];
files: { files: {
file_url: string; fileUrl: string;
file_alt: string; file_alt: string;
}[]; }[];
}; };

View File

@ -25,7 +25,7 @@ type Article = {
title: string; title: string;
}[]; }[];
files: { files: {
file_url: string; fileUrl: string;
file_alt: string; file_alt: string;
}[]; }[];
}; };

View File

@ -16,7 +16,7 @@ type Article = {
title: string; title: string;
}[]; }[];
files: { files: {
file_url: string; fileUrl: string;
file_alt: string; file_alt: string;
}[]; }[];
}; };

View File

@ -16,7 +16,7 @@ type Article = {
title: string; title: string;
}[]; }[];
files: { files: {
file_url: string; fileUrl: string;
file_alt: string; file_alt: string;
}[]; }[];
}; };

View File

@ -6,7 +6,7 @@ const axiosBaseInstance = axios.create({
baseURL, baseURL,
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
"X-Client-Key": "bb65b1ad-e954-4a1a-b4d0-74df5bb0b640" "X-Client-Key": "e41eefe6-70da-4cb2-bf90-aa033fd082be",
}, },
}); });

View File

@ -10,7 +10,7 @@ const axiosInterceptorInstance = axios.create({
baseURL, baseURL,
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
"X-Client-Key": "bb65b1ad-e954-4a1a-b4d0-74df5bb0b640" "X-Client-Key": "e41eefe6-70da-4cb2-bf90-aa033fd082be",
}, },
withCredentials: true, withCredentials: true,
}); });

View File

@ -2,11 +2,11 @@ import axiosBaseInstance from "./axios-base-instance";
const defaultHeaders = { const defaultHeaders = {
"Content-Type": "application/json", "Content-Type": "application/json",
"X-Client-Key": "bb65b1ad-e954-4a1a-b4d0-74df5bb0b640" "X-Client-Key": "e41eefe6-70da-4cb2-bf90-aa033fd082be",
}; };
export async function httpGet(pathUrl: any, headers?: any) { export async function httpGet(pathUrl: any, headers?: any) {
console.log("X-HEADERS : ", defaultHeaders) console.log("X-HEADERS : ", defaultHeaders);
const mergedHeaders = { const mergedHeaders = {
...defaultHeaders, ...defaultHeaders,
...headers, ...headers,

View File

@ -5,11 +5,11 @@ import { getCsrfToken } from "../master-user";
const defaultHeaders = { const defaultHeaders = {
"Content-Type": "application/json", "Content-Type": "application/json",
"X-Client-Key": "bb65b1ad-e954-4a1a-b4d0-74df5bb0b640" "X-Client-Key": "e41eefe6-70da-4cb2-bf90-aa033fd082be",
}; };
export async function httpGetInterceptor(pathUrl: any) { export async function httpGetInterceptor(pathUrl: any) {
console.log("X-HEADERS : ", defaultHeaders) console.log("X-HEADERS : ", defaultHeaders);
const response = await axiosInterceptorInstance const response = await axiosInterceptorInstance
.get(pathUrl, { headers: defaultHeaders }) .get(pathUrl, { headers: defaultHeaders })
.catch((error) => error.response); .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 resCsrf = await getCsrfToken();
const csrfToken = resCsrf?.data?.csrf_token; 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 resCsrf = await getCsrfToken();
const csrfToken = resCsrf?.data?.csrf_token; 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) { export async function httpDeleteInterceptor(pathUrl: any, headers?: any) {
const resCsrf = await getCsrfToken(); const resCsrf = await getCsrfToken();
const csrfToken = resCsrf?.data?.csrf_token; const csrfToken = resCsrf?.data?.csrf_token;
const mergedHeaders = { const mergedHeaders = {