Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ad4b7ff

Browse files
simplified getBaseUrl method in http.js
removed unnecessary function wrapping
1 parent 0e6a520 commit ad4b7ff

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/core/http.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@
33
import request from 'superagent';
44
import ExecutionEnvironment from 'fbjs/lib/ExecutionEnvironment';
55

6-
const getBaseUrl = (() => {
7-
let baseUrl;
8-
return () => baseUrl || (baseUrl = ExecutionEnvironment.canUseDOM ? '' :
6+
const getBaseUrl = () => ExecutionEnvironment.canUseDOM ? '' :
97
process.env.WEBSITE_HOSTNAME ?
108
`http://${process.env.WEBSITE_HOSTNAME}` :
11-
`http://127.0.0.1:${global.server.get('port')}`);
12-
})();
9+
`http://127.0.0.1:${global.server.get('port')}`;
1310

1411
const http = {
15-
12+
1613
get: path => new Promise((resolve, reject) => {
1714
request
1815
.get(getBaseUrl() + path)

0 commit comments

Comments
 (0)