diff --git a/src/App.js b/src/App.js index 1bd3ce0..164e9ef 100644 --- a/src/App.js +++ b/src/App.js @@ -3,6 +3,10 @@ import axios from 'axios' import { About, Tasks, Profile, Projects, Project, Navbar } from './components' +const api = process.env.REACT_APP_API || 'http://localhost:1337' +//console.log(process.env) +console.log('Using api at ' + api) + const defaultState = { user: { name: 'Scott' }, loading: true, @@ -32,13 +36,13 @@ class App extends React.Component { async fetchTasks() { console.log('Fetching tasks...') - const { data } = await axios.get('/api/tasks') + const { data } = await axios.get(api + '/api/tasks') await this.setState({ tasks: data }) } async fetchProjects() { console.log('Fetching projects...') - const { data } = await axios.get('/api/projects') + const { data } = await axios.get(api + '/api/projects') await this.setState({ projects: data }) } diff --git a/src/setupProxy.js b/src/setupProxy.js deleted file mode 100644 index 8ef8955..0000000 --- a/src/setupProxy.js +++ /dev/null @@ -1,5 +0,0 @@ -const proxy = require('http-proxy-middleware') - -module.exports = function(app) { - app.use(proxy('/api', { target: 'http://localhost:1337/' })) -}