Reputation: 1883
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 the imported error type doesn't seem to have any value even though the documentation indicates this should be an export. Am I importing wrong? Comparing wrong? Or something else?
import {RequestError} from 'redux-api-middleware';
const authMiddleware = (store) => (next) => (action) => {
if (action.error) {
if (action.payload) { // not all actions have payloads
if (action.payload instanceof RequestError) {
showNetworkAlert();
}
}
}
next(action);
};
Upvotes: 0
Views: 49