Demo entry 6663302

mc_5

   

Submitted by mc_5 on Nov 29, 2017 at 21:53
Language: TypeScript. Code size: 436 Bytes.

import { handleActions } from 'redux-actions';
import * as Actions from '../constants/actions';

const initialState: AccountStoreState = [{
  id: null,
  username: null,
  roles: [],
  token: null
}];

export default handleActions<AccountStoreState, AccountStoreData>({
  [Actions.LOGIN]: (state, action) => ({
    ...action.data
  }),
  [Actions.LOGOUT]: (state, action) => ({
    initialState
  })
}, initialState);

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).