yazid138 3 years ago
parent
commit
ac6e32d251
6 changed files with 11 additions and 14084 deletions
  1. 1 1
      actions/cabutSanksi.js
  2. 4 2
      actions/pelanggaran.js
  3. 1 1
      actions/sanksi.js
  4. 3 1
      config/axios.js
  5. 1 14079
      package-lock.json
  6. 1 0
      package.json

+ 1 - 1
actions/cabutSanksi.js

@@ -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) {

+ 4 - 2
actions/pelanggaran.js

@@ -1,3 +1,5 @@
+import { get } from "@/config/request";
+
 export const getPelanggaranId = async (id) => {
 	try {
 		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();
 	} catch (error) {
 		console.log("error", error);
@@ -22,7 +24,7 @@ export const getPelanggaranId = async (id) => {
 
 export const getPelanggaran = async () => {
 	try {
-		const res = await fetch("http://localhost:5000/pelanggaran");
+		const res = await get("/pelanggaran");
 		return await res.json();
 	} catch (error) {
 		console.log("error", error);

+ 1 - 1
actions/sanksi.js

@@ -13,7 +13,7 @@ export const createSanksi = async ({ number, ptId }, data) => {
 
 export const getSanksi = async (query = {}) => {
 	try {
-		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 += "?";

+ 3 - 1
config/axios.js

@@ -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,
 });
 

File diff suppressed because it is too large
+ 1 - 14079
package-lock.json


+ 1 - 0
package.json

@@ -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",

Some files were not shown because too many files changed in this diff