This commit is contained in:
Anang Yusman 2025-10-28 14:29:13 +08:00
parent 3b1f089d10
commit 2c824c29b4
6 changed files with 29 additions and 19 deletions

View File

@ -361,7 +361,7 @@ export default function DetailContent() {
<span></span> <span></span>
<span> <span>
<span> <span>
{new Date(articleDetail?.createdAt).toLocaleDateString( {new Date(articleDetail?.publishedAt).toLocaleDateString(
"id-ID", "id-ID",
{ {
day: "numeric", day: "numeric",

View File

@ -1232,14 +1232,16 @@ export default function EditArticleForm(props: { isDetail: boolean }) {
</Button> </Button>
)} */} )} */}
<Button {detailData?.isPublish == true && (
className="bg-red-500 text-white" <Button
variant="outline" className="bg-red-500 text-white"
type="button" variant="outline"
onClick={doUnpublish} type="button"
> onClick={doUnpublish}
Unpublish >
</Button> Unpublish
</Button>
)}
<Link href="/admin/article"> <Link href="/admin/article">
<Button color="danger" variant="outline" type="button"> <Button color="danger" variant="outline" type="button">

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": "9b1c7446-6875-4dc3-84da-eafde4a1ae1f",
}, },
}); });

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": "9b1c7446-6875-4dc3-84da-eafde4a1ae1f",
}, },
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": "9b1c7446-6875-4dc3-84da-eafde4a1ae1f",
}; };
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": "9b1c7446-6875-4dc3-84da-eafde4a1ae1f",
}; };
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 = {