Questions tagged [redux-api-middleware]

21 questions
7
votes
1 answer

Debounce multiple dispatch actions

I have an autocomplete component that requires results from two separate APIs. Both APIs need to be called together with a debounced period since its an autocomplete. I am using react-redux, and redux-api. This is what I have so far. Please see the…
Vishal
  • 345
  • 1
  • 3
  • 10
3
votes
1 answer

Chaining asynchronous actions with redux-api-middleware

I have a React app using Redux, redux-thunk, react-router and redux-api-middleware. In order for a Page component in my app to render, I must access two API endpoints and store their results in the redux store. Currently, I am dispatching both…
Squrler
  • 3,444
  • 8
  • 41
  • 62
2
votes
0 answers

Nock fails to intercept requests in tests, but only in --coverage mode

I recently upgraded some packages in a previously-working app and found that changes in Jest made a bunch of tests fail after the upgrade, but ONLY in --coverage mode. All my Redux API action tests work fine when I run them without the --coverage…
rg_
  • 401
  • 1
  • 4
  • 19
2
votes
1 answer

How do I use Redux API Middleware and Thunk to chain API requests

I have a couple of RSAA actions like so: export const getUserById = id => ({ [RSAA]: { endpoint: "...", method: "GET", headers: { "Content-Type": "application/json" }, credentials: "include", types: [ …
Guy Bowden
  • 4,997
  • 5
  • 38
  • 58
2
votes
1 answer

How to get Next.js and redux-api to work (with next-redux-wrapper)

I’m struggling to get server-side rendering (SSR) to work with redux-api. The app works fine with just client-side rendering (CSR). For SSR to work, I need the data to be available in Next.js’ getInitialProps function. I’m trying to use…
Tom Söderlund
  • 4,743
  • 4
  • 45
  • 67
1
vote
2 answers

redux-api-middleware throws fetch is not defined

I recently upgraded redux-api-middleware from 2.3.0 to 3.0.1 When running my tests with jest@22.2.1 I get this ReferenceError: ReferenceError: fetch is not defined 19 | export function sortPolicyChain (payload: Array):…
josemigallas
  • 3,761
  • 1
  • 29
  • 68
1
vote
0 answers

React / Redux issue with middleware / thunk

I have a large react app that works great on edge, chrome, firefox, safari 11+ etc, however I am facing a strange issue on Safari 10 and IE11. The action/reducer for for login just does not seem to be called in the app in these two browsers. On…
Samnan
  • 653
  • 1
  • 5
  • 13
1
vote
0 answers

redux-api-middleware RSA SUCCESS action meta property lost

I'm using the redux-api-middleware. I have set the meta property of the SUCCESS action and it's being lost when accessing the action in the reducer, regardless of whether I set it as a plain JS object or a function(action, state, res). What makes…
ianbeks
  • 2,198
  • 1
  • 23
  • 26
1
vote
1 answer

How to capture a response from redux-api-middleware

My action: const someAction = () => { return { [RSAA]: { types: [ SOME_REQUEST, SOME_SUCCESS, SOME_FAILURE, ], endpoint: ..., method: 'POST', } }; }; I call it in the following…
Adee
  • 357
  • 1
  • 3
  • 13
1
vote
1 answer

redux-api sync action inside a prefetch block

I am coding a SPA in react.js and I am using redux-api to handle backend connection. I want to do a sync action to refresh the auth token before doing the main action; this way, every time I will do an action to the backend I will be sure that the…
1
vote
1 answer

fetching a plain/text with redux-api-middleware

Can I fetch a txt file with redux-api-middleware? If yes, how? According to the doc the body is set to undefined if not application/JSON compliant, but what I will get is a simple text/plain
Bertuz
  • 2,390
  • 3
  • 25
  • 50
0
votes
1 answer

Getting undefined "type" error when using createAction from redux-api-middleware library

I am trying to use the createAction function but am met with the following error: Uncaught Error: Actions may not have an undefined "type" property. Have you misspelled a constant? I'm not sure why I am getting this but I am assuming it has to do…
0
votes
1 answer

send custom object to reducer in "redux-api-middleware"

I am using redux-api-middleware. My Action for fetching account data : import { RSAA } from "redux-api-middleware"; import { API_ENDPOINT, AUTH_HEADERS } from "../util/constants"; import { ACCESS_TOKEN } from "../util"; export function…
Abhishek kamal
  • 432
  • 1
  • 5
  • 13
0
votes
2 answers

$_POST does not detect the formData passed from ajax

Using redux-api-middleware which works similarly to axios and jquery.ajax, I passed a formData which is a mixture of an image and other form values as you can see on this image: The problem I have is that after successfully calling the API via a…
The Bassman
  • 2,241
  • 5
  • 26
  • 38
0
votes
1 answer

How to detect specific error type using an error type imported from redux-api-middleware

In my react native app, I'm trying to handle custom errors from a third party library: redux-api-middleware. The documentation indicates the custom error type exports but when I import and then check for type equality it does not work. When I debug…
izikandrw
  • 1,703
  • 3
  • 14
  • 23
1
2