@@ -2,7 +2,7 @@ import { post } from "../config/request";
export const addCabutSanksi = async ({ noSanksi, ptId }, data) => {
try {
- const res = await post(`http://localhost:5000/cabut-sanksi/add?noSanksi=${noSanksi}&ptId=${ptId}`, data);
+ const res = await post(`/cabut-sanksi/add?noSanksi=${noSanksi}&ptId=${ptId}`, data);
console.log(res);
return res.data;
} catch (error) {
@@ -1,3 +1,5 @@
+import { get } from "@/config/request";
+
export const getPelanggaranId = async (id) => {
const data = { id };
@@ -12,7 +14,7 @@ export const getPelanggaranId = async (id) => {
headers: myHeaders,
};
- const res = await fetch("http://localhost:5000/pelanggaran", requestOptions);
+ const res = await get("/pelanggaran", requestOptions);
return await res.json();
console.log("error", error);
@@ -22,7 +24,7 @@ export const getPelanggaranId = async (id) => {
export const getPelanggaran = async () => {
- const res = await fetch("http://localhost:5000/pelanggaran");
+ const res = await get("/pelanggaran");
@@ -13,7 +13,7 @@ export const createSanksi = async ({ number, ptId }, data) => {
export const getSanksi = async (query = {}) => {
- let url = "http://localhost:5000/sanksi";
+ let url = "/sanksi";
if (query != null) {
const { ptId, noSanksi, keberatan, jawaban, banding, active, cabutSanksi, docPerbaikan, role, orgId } = query;
url += "?";
@@ -1,8 +1,10 @@
import axios from "axios";
// import jwt_decode from "jwt-decode";
+import env from "dotenv";
+env.config();
const axiosAPI = axios.create({
- baseURL: "http://localhost:5000",
+ baseURL: process.env.API_URL || "http://localhost:5000",
withCredentials: true,
});
@@ -43,6 +43,7 @@
"datatables.net-responsive": "2.2.7",
"datatables.net-responsive-bs": "2.2.7",
"deep-equal": "1.1.1",
+ "dotenv": "^16.0.0",
"draft-js": "0.11.7",
"easy-pie-chart": "2.1.7",
"express": "4.17.1",