redux-csrf

Keep your csrf token inside your Redux store.

Usage no npm install needed!

<script type="module">
  import reduxCsrf from 'https://cdn.skypack.dev/redux-csrf';
</script>

README

redux-csrf

Keep your csrf token inside your Redux store.

Travis Codecov Status npm package npm downloads license

Dependency Status devDependency Status peerDependency Status

Installation

$ npm install redux-csrf --save

Usage

import { default as reducer, actions } from 'redux-csrf';

// Server side with csurf middleware
store.dispatch(actions.setCsrfToken(req.csrfToken()));

// Reducer
combineReducers({
  ...otherReducers
  _csrf: reducer,
});

API

setCsrfToken(token)

Set CSRF token to redux store.

Test

$ npm run lint
$ npm run test:watch

CONTRIBUTING

  • ⇄ Pull requests and ★ Stars are always welcome.
  • For bugs and feature requests, please create an issue.
  • Pull requests must be accompanied by passing automated tests ($ npm test).

CHANGELOG

LICENSE

MIT: http://michaelhsu.mit-license.org