Sha256: 16c2e3ddc392054d38b8449bae091431192a15e7f13a086d803db5432ffe5d47
Contents?: true
Size: 521 Bytes
Versions: 5
Compression:
Stored size: 521 Bytes
Contents
import helpers from 'redux/middlewares/authentication_middleware/helpers'; import storage from 'storage'; const authMiddleware = () => next => (action) => { if (helpers.isLoginAction(action)) { storage.setItem('auth_token', action.payload.jwt); } if (helpers.isLogoutAction(action)) { storage.removeItem('auth_token'); } if (helpers.isFailureAction(action) && helpers.isUnauthorizedError(action)) { storage.removeItem('auth_token'); } return next(action); }; export default authMiddleware;
Version data entries
5 entries across 5 versions & 1 rubygems