Skip to content

Commit

Permalink
Add cross-env
Browse files Browse the repository at this point in the history
  • Loading branch information
eladhayun committed Mar 27, 2020
1 parent f62208b commit 6365afe
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 77 deletions.
1 change: 1 addition & 0 deletions env/.env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_API_SERVER=http://localhost:8080
1 change: 1 addition & 0 deletions env/.env.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_API_SERVER=http://localhost:8080
1 change: 1 addition & 0 deletions env/.env.staging
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_API_SERVER=http://localhost:8080
119 changes: 52 additions & 67 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
"typeface-roboto": "0.0.75"
},
"devDependencies": {
"cross-env": "^7.0.2",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-prettier": "^3.1.2",
"http-proxy-middleware": "^1.0.3",
"husky": "^4.2.3",
"lint-staged": "^10.0.9",
"prettier": "^2.0.2"
},
"scripts": {
"start": "react-scripts start",
"start": "cross-env react-scripts start",
"build": "react-scripts build"
},
"eslintConfig": {
Expand Down
16 changes: 8 additions & 8 deletions src/utils/ajaxUtils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ajax } from 'rxjs/ajax'
import { getApiToken } from './authUtils'
import { pickBy, identity, memoize } from 'lodash'

const defaultHeaders = {
contentType: {
Expand All @@ -10,15 +11,14 @@ const defaultHeaders = {
}
}

function defaultAuthHeaders() {
const apiToken = getApiToken()
if (apiToken) {
return {
const defaultAuthHeaders = memoize(() => {
return pickBy(
{
Authorization: getApiToken()
}
}
return {}
}
},
identity
)
})

export const getJSON = (url, headers = {}) => {
return ajax.getJSON(url, {
Expand Down

0 comments on commit 6365afe

Please sign in to comment.