Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some tweaks to make codebase look better #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { reachGraphQL } from './reachGraphQL.js';
import { reachWithDispatch } from './reachWithDispatch.js';
import { reachGraphQL } from './reachGraphQL';
import { reachWithDispatch } from './reachWithDispatch';

export {
reachGraphQL,
Expand Down
6 changes: 2 additions & 4 deletions src/reachGraphQL.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { transport } from './utils/transport.js';
import { transport } from './utils/transport';

/**
* [reachGraphQL Makes queres or mutations against GraphQL]
Expand All @@ -9,7 +9,5 @@ import { transport } from './utils/transport.js';
*/

export function reachGraphQL (path, query, queryParams = {}, token) {
return transport(path, query, queryParams, token).then((res) => {
return res;
});
return transport(path, query, queryParams, token).then(res => res);
}
9 changes: 2 additions & 7 deletions src/reachWithDispatch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { transport } from './utils/transport.js';
import { transport } from './utils/transport';

/**
* [reachWithDispatch description]
Expand All @@ -9,10 +9,5 @@ import { transport } from './utils/transport.js';
* @return {[function]} [dispatch to store]
*/
export function reachWithDispatch (path, query, queryParams = {}, token, actionCreator) {
return transport(path, query, queryParams, token)
.then((res) => {
return dispatch => {
return dispatch(actionCreator(res));
}
});
return transport(path, query, queryParams, token).then(res => dispatch => dispatch(actionCreator(res)));
}
6 changes: 2 additions & 4 deletions src/utils/transport.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ export function transport (path, query, queryParams, token) {
queryParams
})
})
.then((response) => {
return response.json();
})
.then((responseBody) => {
.then(response => response.json())
.then(responseBody => {
if (responseBody && responseBody.errors) {
throw new Error(responseBody.errors);
}
Expand Down