-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(graphql): update graphql to match new gtfs-api
- Loading branch information
1 parent
92194c3
commit b53d7e8
Showing
6 changed files
with
124 additions
and
153 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 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,42 +1,22 @@ | ||
import fetch from 'isomorphic-fetch' | ||
import {createAction} from 'redux-actions' | ||
import { compose, routes } from '../../gtfs/util/graphql' | ||
|
||
export function fetchingRoutes (feedId) { | ||
return { | ||
type: 'FETCH_GRAPHQL_ROUTES', | ||
feedId | ||
} | ||
} | ||
|
||
export function clearRoutes () { | ||
return { | ||
type: 'CLEAR_GRAPHQL_ROUTES' | ||
} | ||
} | ||
|
||
export function errorFetchingRoutes (feedId, data) { | ||
return { | ||
type: 'FETCH_GRAPHQL_ROUTES_REJECTED', | ||
data | ||
} | ||
} | ||
|
||
export function receiveRoutes (feedId, data) { | ||
return { | ||
type: 'FETCH_GRAPHQL_ROUTES_FULFILLED', | ||
data | ||
} | ||
} | ||
export const fetchingRoutes = createAction('FETCH_GRAPHQL_ROUTES') | ||
export const clearRoutes = createAction('CLEAR_GRAPHQL_ROUTES') | ||
export const errorFetchingRoutes = createAction('FETCH_GRAPHQL_ROUTES_REJECTED') | ||
const receiveRoutes = createAction('FETCH_GRAPHQL_ROUTES_FULFILLED') | ||
|
||
export function fetchRoutes (feedId) { | ||
export function fetchRoutes (namespace) { | ||
return function (dispatch, getState) { | ||
dispatch(fetchingRoutes(feedId)) | ||
return fetch(compose(routes, { feedId: feedId })) | ||
dispatch(fetchingRoutes(namespace)) | ||
return fetch(compose(routes, { namespace })) | ||
.then((response) => { | ||
return response.json() | ||
}) | ||
.then(json => { | ||
dispatch(receiveRoutes(feedId, json)) | ||
const {routes} = json.feed | ||
dispatch(receiveRoutes({namespace, routes})) | ||
}) | ||
} | ||
} |
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
Oops, something went wrong.