Last active
December 8, 2017 12:11
-
-
Save vzaidman/9d3b582f891e8118195daa5b07d9596c to your computer and use it in GitHub Desktop.
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 { makeThunkActionCreator } from 'redux-toolbelt-thunk' | |
import { api } from '../services' | |
export const login = makeThunkActionCreator(‘login’,(email, password) => api.login(email, password))) | |
export const signUp = makeThunkActionCreator(‘signUp’, signUpData => api.signUp(signUpData)) | |
export const fetchProfile = makeThunkActionCreator(‘fetchProfile’, () => api.fetchProfile()) | |
export const logout = makeThunkActionCreator(‘logout’, () => api.logout().then(() => {return undefined}) | |
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 { composeReducers, makeAsyncReducer } from 'redux-toolbelt' | |
import { login, logout, signUp, fetchProfile } from './actions' | |
export const profile = composeReducers( | |
makeAsyncReducer(login), | |
makeAsyncReducer(signUp), | |
makeAsyncReducer(fetchProfile, { shouldDestroyData: false }), | |
makeAsyncReducer(logout), | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment