Refactor how base API url is set on frontend

This commit is contained in:
Dana Lambert 2021-11-25 10:22:51 +13:00 committed by Alistair McIntyre
parent ecc6e9eabe
commit 043d89bd04
4 changed files with 17 additions and 23 deletions

View file

@ -1 +0,0 @@
export const API_URL = "http://localhost:8000/api";

View file

@ -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"] = "*";