yazid138 3 years ago
parent
commit
1c34b37e96
3 changed files with 8 additions and 6 deletions
  1. 3 3
      actions/pelanggaran.js
  2. 3 3
      config/axios.js
  3. 2 0
      env.js

+ 3 - 3
actions/pelanggaran.js

@@ -1,4 +1,4 @@
-import { get } from "@/config/request";
+import { get } from "../config/request";
 
 export const getPelanggaranId = async (id) => {
 	try {
@@ -15,7 +15,7 @@ export const getPelanggaranId = async (id) => {
 		};
 
 		const res = await get("/pelanggaran", requestOptions);
-		return await res.json();
+		return await res.data;
 	} catch (error) {
 		console.log("error", error);
 		return false;
@@ -25,7 +25,7 @@ export const getPelanggaranId = async (id) => {
 export const getPelanggaran = async () => {
 	try {
 		const res = await get("/pelanggaran");
-		return await res.json();
+		return await res.data;
 	} catch (error) {
 		console.log("error", error);
 		return false;

+ 3 - 3
config/axios.js

@@ -1,10 +1,10 @@
 import axios from "axios";
 // import jwt_decode from "jwt-decode";
-import env from "dotenv";
-env.config();
+// require("dotenv").config();
+import { API_URL } from "@/env";
 
 const axiosAPI = axios.create({
-	baseURL: process.env.API_URL || "http://localhost:5000",
+	baseURL: API_URL || "http://localhost:5000",
 	withCredentials: true,
 });
 

+ 2 - 0
env.js

@@ -0,0 +1,2 @@
+// export const TOKEN=77aecfec-10ac-3b4f-ab59-3fbfbeed6324
+export const API_URL = "http://localhost:5000";