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;
}[];
files: {
file_url: string;
fileUrl: string;
file_alt: string;
}[];
};
@ -252,9 +252,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

@ -623,9 +623,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>
@ -640,7 +638,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>
@ -663,7 +661,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

@ -234,7 +234,7 @@ export default function Login() {
<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">
<svg
className="w-8 h-8 text-orange-600"
className="w-8 h-8 text-blue-600"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
@ -330,7 +330,7 @@ export default function Login() {
<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">
<svg
className="w-8 h-8 text-red-600"
className="w-8 h-8 text-blue-600"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
@ -396,7 +396,7 @@ export default function Login() {
</Link>
<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)}
>
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="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
className="w-8 h-8 text-orange-600"
className="w-8 h-8 text-blue-600"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
@ -486,7 +486,7 @@ export default function Login() {
<Button
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}
>
Masuk ke Portal

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

View File

@ -16,7 +16,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 Footer() {
@ -64,7 +64,7 @@ export default function Footer() {
<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;
}[];
};

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() {
@ -55,7 +55,7 @@ export default function Header() {
{articles.slice(0, 2).map((article, idx) => {
const imageUrl =
article.thumbnailUrl ||
article.files?.[0]?.file_url ||
article.files?.[0]?.fileUrl ||
"/placeholder.png";
const category =

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

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