fix:service instance
This commit is contained in:
parent
e5a7990af0
commit
30d7250abf
|
|
@ -8,6 +8,7 @@ import {
|
|||
import Cookies from "js-cookie";
|
||||
import { stat } from "fs";
|
||||
import axiosInterceptorInstanceHumas from "./http-config/konten-humas-base-service";
|
||||
import { httpGetInterceptor } from "./http-config/http-interceptor-services";
|
||||
|
||||
const token = Cookies.get("access_token");
|
||||
export async function getListArticle(props: PaginationRequest) {
|
||||
|
|
@ -63,7 +64,7 @@ export async function getListArticleAdminPage(props: PaginationRequest) {
|
|||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpGet(
|
||||
return await httpGetInterceptor(
|
||||
`/articles?sort=desc&sortBy=created_at&limit=${limit}&page=${page}&isPublish=${
|
||||
isPublish === undefined ? "" : isPublish
|
||||
}&title=${search}&startDate=${startDate || ""}&endDate=${
|
||||
|
|
@ -72,8 +73,7 @@ export async function getListArticleAdminPage(props: PaginationRequest) {
|
|||
sort || "asc"
|
||||
}&category=${categorySlug || ""}&isBanner=${isBanner || ""}&categoryIds=${
|
||||
categoryIds || ""
|
||||
}&createdByIds=${createdByIds || ""}`,
|
||||
headers
|
||||
}&createdByIds=${createdByIds || ""}`
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { useRouter } from "next/navigation";
|
||||
import axiosInterceptorInstance from "./axios-interceptor-instance";
|
||||
import Cookies from "js-cookie";
|
||||
import axiosInterceptorInstance from "./axios-interceptor-service";
|
||||
|
||||
export async function httpGetInterceptor(pathUrl: any) {
|
||||
const response = await axiosInterceptorInstance
|
||||
|
|
@ -28,7 +28,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 response = await axiosInterceptorInstance
|
||||
.post(pathUrl, data, { headers })
|
||||
.catch((error) => error.response);
|
||||
|
|
|
|||
Loading…
Reference in New Issue