forked from docker/awesome-compose
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[react-express-mongdb] use compose network to communicate between ser…
…vices (docker#62) Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
- Loading branch information
Showing
4 changed files
with
20 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
16 changes: 5 additions & 11 deletions
16
react-express-mongodb/frontend/src/utilities/httpRequestHandler.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,16 @@ | ||
import axios from 'axios'; | ||
import config from '../config/constants'; | ||
|
||
|
||
export async function request (method, uri, data, headers = null, params = null) { | ||
let url = (config.API_BASE_URL + uri); | ||
export function request (method, uri, data, headers = null, params = null) { | ||
let query = { | ||
method: method, | ||
url: url | ||
method, | ||
url: uri | ||
}; | ||
if (headers !== null) | ||
query.headers = headers; | ||
if (params !== null) | ||
query.params = params; | ||
if (method === 'post' || method === 'put' || method === 'delete' || method === 'patch') | ||
query.data = data; | ||
try { | ||
return await axios(query); | ||
} catch (e) { | ||
throw e; | ||
} | ||
} | ||
return axios(query); | ||
} |