Skip to content

Commit

Permalink
fix(queries): use provided route method if any
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbonnet committed Mar 18, 2019
1 parent c6d85e4 commit 24eb6c8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
assign,
pick,
upperFirst,
lowerCase,
} from 'lodash'
import { compose, withPropsOnChange } from 'recompose'

Expand Down Expand Up @@ -171,11 +172,13 @@ export function toFetchQuery(routes, transform = identity) {
const { method = 'get' } = query
const routeOrUrl = routes[query.type][method](query)
const route = isString(routeOrUrl) ? { url: routeOrUrl } : routeOrUrl
const { method: fetchMethod = method } = route
return next(
transform(
{
body: BODY_METHODS[method] && JSON.stringify(query.value),
method: method === 'list' ? 'GET' : upperCase(method),
body:
BODY_METHODS[lowerCase(fetchMethod)] && JSON.stringify(query.value),
method: fetchMethod === 'list' ? 'GET' : upperCase(fetchMethod),
mode: 'cors',
cache: 'no-store',
signal: query.signal,
Expand Down

0 comments on commit 24eb6c8

Please sign in to comment.