Refactor how base API url is set on frontend
This commit is contained in:
parent
ecc6e9eabe
commit
043d89bd04
4 changed files with 17 additions and 23 deletions
|
@ -1 +0,0 @@
|
|||
export const API_URL = "http://localhost:8000/api";
|
|
@ -1,12 +1,8 @@
|
|||
import axios from "axios"
|
||||
import { API_URL } from "../config";
|
||||
|
||||
// Base URL used by all requests
|
||||
const baseUrl = API_URL;
|
||||
|
||||
// Create the axios object
|
||||
const repo = axios.create({
|
||||
baseURL: baseUrl,
|
||||
baseURL: "/api",
|
||||
});
|
||||
|
||||
repo.defaults.headers.post["access-control-allow-origin"] = "*";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue