fix:local api
This commit is contained in:
parent
f516565446
commit
a5360837c7
|
|
@ -7,10 +7,7 @@
|
||||||
* - Atau gunakan NEXT_PUBLIC_LOCAL_API_URL jika ingin endpoint terpisah
|
* - Atau gunakan NEXT_PUBLIC_LOCAL_API_URL jika ingin endpoint terpisah
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import { httpGet, httpPost } from "./http-config/http-base-services";
|
||||||
httpGet,
|
|
||||||
httpPost,
|
|
||||||
} from "./http-config/http-base-services";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
httpGetInterceptor,
|
httpGetInterceptor,
|
||||||
|
|
@ -26,7 +23,11 @@ export async function getDataFromLocal(endpoint: string, headers?: any) {
|
||||||
return await httpGet(endpoint, headers);
|
return await httpGet(endpoint, headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function postDataToLocal(endpoint: string, data: any, headers?: any) {
|
export async function postDataToLocal(
|
||||||
|
endpoint: string,
|
||||||
|
data: any,
|
||||||
|
headers?: any,
|
||||||
|
) {
|
||||||
return await httpPost(endpoint, data, headers);
|
return await httpPost(endpoint, data, headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -34,14 +35,22 @@ export async function postDataToLocal(endpoint: string, data: any, headers?: any
|
||||||
// Menggunakan axios-interceptor-instance.ts dengan Bearer token
|
// Menggunakan axios-interceptor-instance.ts dengan Bearer token
|
||||||
|
|
||||||
export async function getDataWithAuth(endpoint: string, headers?: any) {
|
export async function getDataWithAuth(endpoint: string, headers?: any) {
|
||||||
return await httpGetInterceptor(endpoint, headers);
|
return await httpGet(endpoint, headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function postDataWithAuth(endpoint: string, data: any, headers?: any) {
|
export async function postDataWithAuth(
|
||||||
|
endpoint: string,
|
||||||
|
data: any,
|
||||||
|
headers?: any,
|
||||||
|
) {
|
||||||
return await httpPostInterceptor(endpoint, data, headers);
|
return await httpPostInterceptor(endpoint, data, headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updateDataWithAuth(endpoint: string, data: any, headers?: any) {
|
export async function updateDataWithAuth(
|
||||||
|
endpoint: string,
|
||||||
|
data: any,
|
||||||
|
headers?: any,
|
||||||
|
) {
|
||||||
return await httpPutInterceptor(endpoint, data, headers);
|
return await httpPutInterceptor(endpoint, data, headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,4 +80,3 @@ export async function updateUser(id: string | number, data: any) {
|
||||||
export async function deleteUser(id: string | number) {
|
export async function deleteUser(id: string | number) {
|
||||||
return await httpDeleteInterceptor(`/users/${id}`);
|
return await httpDeleteInterceptor(`/users/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue