Socket
Socket
Sign inDemoInstall

@breadhead/thunk-error

Package Overview
Dependencies
3
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @breadhead/thunk-error

Middleware for handling errors in thunk


Version published
Maintainers
3
Install size
6.54 kB
Created

Changelog

Source

1.0.3 (2019-01-17)

Bug Fixes

  • add throwing exception if error checking failed (7b4bff8)

<a name="1.0.2"></a>

Readme

Source

thunk-error

Instalation

yarn add @breadhead/thunk-error

Usage

import { applyMiddleware, combineReducers, createStore } from 'redux'
import thunk from 'redux-thunk';

import { createErrorMiddleware } from '@breadhead/thunk-error'

export const unauthorizedMiddleware = createErrorMiddleware(
  (err) => !!err && (err.status === 401 || err.status === 403), // middleware supports this error?
  () => actions.authViolateStatus(), // dispatch result of this function  on error
)

const reducer = combineReducers({
  first: firstReducer,
})

const store = createStore(
  reducer,
  initialState,
  applyMiddleware(
    unauthorizedMiddleware,
    thunk,
  ),
)

Keywords

FAQs

Last updated on 17 Jan 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc