Add axios library to frontend with base repository

This commit is contained in:
Dana Lambert 2021-10-07 10:22:07 +13:00
parent b699e50754
commit 9b17536102
4 changed files with 33 additions and 0 deletions

1
frontend/src/config.js Normal file
View file

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

View file

@ -0,0 +1,14 @@
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,
});
repo.defaults.headers.post["access-control-allow-origin"] = "*";
export default repo;