Skip to content

Commit

Permalink
Merge pull request #341 from sasjs/base-url
Browse files Browse the repository at this point in the history
fix(web): add proper base url in axios.defaults
  • Loading branch information
allanbowe authored Mar 1, 2023
2 parents 737b345 + 5e3ce8a commit a373a4e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion web/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import axios from 'axios'
const NODE_ENV = process.env.NODE_ENV
const PORT_API = process.env.PORT_API
const baseUrl =
NODE_ENV === 'development' ? `http://localhost:${PORT_API ?? 5000}` : ''
NODE_ENV === 'development'
? `http://localhost:${PORT_API ?? 5000}`
: window.location.origin + window.location.pathname

axios.defaults = Object.assign(axios.defaults, {
withCredentials: true,
Expand Down

0 comments on commit a373a4e

Please sign in to comment.