Created
November 20, 2020 14:17
-
-
Save GuilhermeLis/bf593e88338f1596b3cbe75976df1e55 to your computer and use it in GitHub Desktop.
auth/ducks.ts from Redux with AsyncStorage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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