Add axios library to frontend with base repository
This commit is contained in:
parent
b699e50754
commit
9b17536102
4 changed files with 33 additions and 0 deletions
1
frontend/src/config.js
Normal file
1
frontend/src/config.js
Normal file
|
@ -0,0 +1 @@
|
|||
export const API_URL = "http://localhost:8000";
|
14
frontend/src/repository/Repository.js
Normal file
14
frontend/src/repository/Repository.js
Normal 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;
|
Loading…
Add table
Add a link
Reference in a new issue