Sha256: e08e7cc49103df8d75940ad0049d85ec78e8876007edaa241623211d037b6422

Contents?: true

Size: 604 Bytes

Versions: 5

Compression:

Stored size: 604 Bytes

Contents

import { endsWith, get } from 'lodash';
import appConfig from 'redux/nodes/app/config';

const { LOGIN_SUCCESS, LOGOUT_SUCCESS } = appConfig.actionTypes;
const UNAUTHORIZED_ERROR = 401;

const isFailureAction = (action) => {
  return endsWith(action.type, '_FAILURE');
};

const isLoginAction = action => action.type === LOGIN_SUCCESS;
const isLogoutAction = action => action.type === LOGOUT_SUCCESS;

const isUnauthorizedError = action => get(action, 'payload.errors.http_status') === UNAUTHORIZED_ERROR;

export default {
  isFailureAction,
  isLoginAction,
  isLogoutAction,
  isUnauthorizedError,
};

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gnarails-1.0.0 templates/react/js/redux/middlewares/authentication_middleware/helpers.js
gnarails-0.9.3 templates/react/js/redux/middlewares/authentication_middleware/helpers.js
gnarails-0.9.2 templates/react/js/redux/middlewares/authentication_middleware/helpers.js
gnarails-0.9.1 templates/react/js/redux/middlewares/authentication_middleware/helpers.js
gnarails-0.9.0 templates/react/js/redux/middlewares/authentication_middleware/helpers.js