Skip to content
This repository has been archived by the owner on May 28, 2018. It is now read-only.

Commit

Permalink
Refactor axios baseurl set in a single spot
Browse files Browse the repository at this point in the history
  • Loading branch information
nbrohee committed Feb 28, 2017
1 parent cf4f5fb commit 079ad44
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 0 additions & 2 deletions client/src/api/applicationApi.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import axios from 'axios'
import { getFilename } from './requestUtils'
// eslint-disable-next-line no-undef
axios.defaults.baseURL = API_URI

class applicationApi {

Expand Down
6 changes: 6 additions & 0 deletions client/src/api/configureAxios.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import axios from 'axios'

export default function configureAxios() {
// eslint-disable-next-line no-undef
axios.defaults.baseURL = API_URI
}
2 changes: 0 additions & 2 deletions client/src/api/userApi.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import axios from 'axios'
// eslint-disable-next-line no-undef
axios.defaults.baseURL = API_URI

class userApi {
static loginUser(user) {
Expand Down
2 changes: 2 additions & 0 deletions client/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'babel-polyfill'
import React from 'react'
import { render } from 'react-dom'
import configureStore from './store/configureStore'
import configureAxios from './api/configureAxios'
import {Provider} from 'react-redux'
import { Router, browserHistory } from 'react-router'
import routes from './routes'
Expand All @@ -13,6 +14,7 @@ import './styles/beta-ribbon.css'
import '../node_modules/toastr/build/toastr.min.css'

const store = configureStore()
configureAxios()

render(
<Provider store={store}>
Expand Down

0 comments on commit 079ad44

Please sign in to comment.