This commit is contained in:
Anang Yusman 2025-09-23 16:08:09 +08:00
parent 56d8d7ea55
commit af3649fcb0
11 changed files with 41 additions and 35 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

@ -234,7 +234,7 @@ export default function Login() {
<div className="text-center mb-8"> <div className="text-center mb-8">
<div className="w-16 h-16 bg-orange-100 rounded-full flex items-center justify-center mx-auto mb-4"> <div className="w-16 h-16 bg-orange-100 rounded-full flex items-center justify-center mx-auto mb-4">
<svg <svg
className="w-8 h-8 text-orange-600" className="w-8 h-8 text-blue-600"
fill="none" fill="none"
stroke="currentColor" stroke="currentColor"
viewBox="0 0 24 24" viewBox="0 0 24 24"
@ -330,7 +330,7 @@ export default function Login() {
<div className="text-center mb-8"> <div className="text-center mb-8">
<div className="w-16 h-16 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-4"> <div className="w-16 h-16 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-4">
<svg <svg
className="w-8 h-8 text-red-600" className="w-8 h-8 text-blue-600"
fill="none" fill="none"
stroke="currentColor" stroke="currentColor"
viewBox="0 0 24 24" viewBox="0 0 24 24"
@ -396,7 +396,7 @@ export default function Login() {
</Link> </Link>
<button <button
className="text-sm text-red-600 hover:text-red-700 font-medium transition-colors" className="text-sm text-blue-600 hover:text-blue-700 font-medium transition-colors"
onClick={() => setIsResetPassword(false)} onClick={() => setIsResetPassword(false)}
> >
Kembali ke Login Kembali ke Login
@ -407,9 +407,9 @@ export default function Login() {
) : ( ) : (
<div className="bg-white rounded-2xl shadow-xl p-8 border border-gray-100"> <div className="bg-white rounded-2xl shadow-xl p-8 border border-gray-100">
<div className="text-center mb-8"> <div className="text-center mb-8">
<div className="w-16 h-16 bg-orange-100 rounded-full flex items-center justify-center mx-auto mb-4"> <div className="w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4">
<svg <svg
className="w-8 h-8 text-orange-600" className="w-8 h-8 text-blue-600"
fill="none" fill="none"
stroke="currentColor" stroke="currentColor"
viewBox="0 0 24 24" viewBox="0 0 24 24"
@ -486,7 +486,7 @@ export default function Login() {
<Button <Button
size="lg" size="lg"
className="w-full bg-gradient-to-r from-orange-500 to-orange-600 hover:from-orange-600 hover:to-orange-700 text-white font-semibold py-3 rounded-lg transition-all duration-200 shadow-lg hover:shadow-xl" className="w-full bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white font-semibold py-3 rounded-lg transition-all duration-200 shadow-lg hover:shadow-xl"
onClick={onSubmit} onClick={onSubmit}
> >
Masuk ke Portal Masuk ke Portal

View File

@ -15,7 +15,7 @@ type Article = {
createdByName: string; createdByName: string;
thumbnailUrl: string; thumbnailUrl: string;
categories: { title: string }[]; categories: { title: string }[];
files: { file_url: string; file_alt: string }[]; files: { fileUrl: string; file_alt: string }[];
}; };
export default function BreakingNews() { export default function BreakingNews() {
@ -89,7 +89,7 @@ export default function BreakingNews() {
<Image <Image
src={ src={
mainArticle.thumbnailUrl || mainArticle.thumbnailUrl ||
mainArticle.files?.[0]?.file_url || mainArticle.files?.[0]?.fileUrl ||
"/placeholder.png" "/placeholder.png"
} }
alt={mainArticle.title} alt={mainArticle.title}
@ -155,7 +155,7 @@ export default function BreakingNews() {
{editorArticles?.map((article) => { {editorArticles?.map((article) => {
const imageUrl = const imageUrl =
article.thumbnailUrl || article.thumbnailUrl ||
article.files?.[0]?.file_url || article.files?.[0]?.fileUrl ||
"/placeholder.png"; "/placeholder.png";
const category = const category =
@ -215,7 +215,7 @@ export default function BreakingNews() {
{newsArticles?.map((article) => { {newsArticles?.map((article) => {
const imageUrl = const imageUrl =
article.thumbnailUrl || article.thumbnailUrl ||
article.files?.[0]?.file_url || article.files?.[0]?.fileUrl ||
"/placeholder.png"; "/placeholder.png";
return ( return (
@ -295,7 +295,7 @@ export default function BreakingNews() {
<Image <Image
src={ src={
a.thumbnailUrl || a.thumbnailUrl ||
a.files?.[0]?.file_url || a.files?.[0]?.fileUrl ||
"/placeholder.png" "/placeholder.png"
} }
alt={a.title} alt={a.title}
@ -369,7 +369,7 @@ export default function BreakingNews() {
<Image <Image
src={ src={
popularArticles[0].thumbnailUrl || popularArticles[0].thumbnailUrl ||
popularArticles[0].files?.[0]?.file_url || popularArticles[0].files?.[0]?.fileUrl ||
"/placeholder.png" "/placeholder.png"
} }
alt={popularArticles[0].title} alt={popularArticles[0].title}

View File

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

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

@ -15,7 +15,7 @@ type Article = {
createdByName: string; createdByName: string;
thumbnailUrl: string; thumbnailUrl: string;
categories: { title: string }[]; categories: { title: string }[];
files: { file_url: string; file_alt: string }[]; files: { fileUrl: string; file_alt: string }[];
}; };
export default function Header() { export default function Header() {
@ -55,7 +55,7 @@ export default function Header() {
{articles.slice(0, 2).map((article, idx) => { {articles.slice(0, 2).map((article, idx) => {
const imageUrl = const imageUrl =
article.thumbnailUrl || article.thumbnailUrl ||
article.files?.[0]?.file_url || article.files?.[0]?.fileUrl ||
"/placeholder.png"; "/placeholder.png";
const category = const category =

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": "5b64a5b9-b553-469b-8e7d-77f8011a97fe",
}, },
}); });

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": "5b64a5b9-b553-469b-8e7d-77f8011a97fe",
}, },
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": "5b64a5b9-b553-469b-8e7d-77f8011a97fe",
}; };
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": "5b64a5b9-b553-469b-8e7d-77f8011a97fe",
}; };
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;