File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -13,13 +13,7 @@ function formatUrl(path) {
13
13
return '/api' + adjustedPath ;
14
14
}
15
15
16
- /*
17
- * This silly underscore is here to avoid a mysterious "ReferenceError: ApiClient is not defined" error.
18
- * See Issue #14. https://github.com/erikras/react-redux-universal-hot-example/issues/14
19
- *
20
- * Remove it at your own risk.
21
- */
22
- class _ApiClient {
16
+ export default class ApiClient {
23
17
constructor ( req ) {
24
18
methods . forEach ( ( method ) =>
25
19
this [ method ] = ( path , { params, data } = { } ) => new Promise ( ( resolve , reject ) => {
@@ -40,8 +34,15 @@ class _ApiClient {
40
34
request . end ( ( err , { body } = { } ) => err ? reject ( body || err ) : resolve ( body ) ) ;
41
35
} ) ) ;
42
36
}
37
+ /*
38
+ * There's a V8 bug where, when using Babel, exporting classes with only
39
+ * constructors sometimes fails. Until it's patched, this is a solution to
40
+ * "ApiClient is not defined" from issue #14.
41
+ * https://github.com/erikras/react-redux-universal-hot-example/issues/14
42
+ *
43
+ * Relevant Babel bug (but they claim it's V8): https://phabricator.babeljs.io/T2455
44
+ *
45
+ * Remove it at your own risk.
46
+ */
47
+ empty ( ) { }
43
48
}
44
-
45
- const ApiClient = _ApiClient ;
46
-
47
- export default ApiClient ;
You can’t perform that action at this time.
0 commit comments