Skip to content

Instantly share code, notes, and snippets.

@GuilhermeLis
Created November 20, 2020 14:17
Show Gist options
  • Save GuilhermeLis/bf593e88338f1596b3cbe75976df1e55 to your computer and use it in GitHub Desktop.
Save GuilhermeLis/bf593e88338f1596b3cbe75976df1e55 to your computer and use it in GitHub Desktop.
auth/ducks.ts from Redux with AsyncStorage
import { createReducer, createActions } from 'reduxsauce';
import Immutable from 'seamless-immutable';
const { Types, Creators } = createActions({
signInRequest: ['email', 'password'],
});
export const AuthTypes = Types;
export default Creators;
export const INITIAL_STATE = Immutable({
token: '',
isLogged: false
});
type INITIAL_STATE_TYPE = typeof INITIAL_STATE;
export const reducer = createReducer(INITIAL_STATE, {
[Types.SIGN_IN_REQUEST]: (state: INITIAL_STATE_TYPE) => state,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment