Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import loginService from '../services/login'
- const loginReducer = (state = '', action) => {
- switch (action.type) {
- case 'SET_LOGIN':
- return action.data
- default:
- return state
- }
- }
- export const acLogin = ({ username, password }) => {
- return async dispatch => {
- const user = await loginService.login({ username, password })
- dispatch({
- type: 'SET_LOGIN',
- data: user
- })
- }
- }
- export default (loginReducer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement