123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- import {
- LOGIN,
- MINUS
- } from '../constants/user'
-
- // landlord: 'landlord',
- // customer:'customer'
- // adminuser
- const INITIAL_STATE = {
-
- phone:false
- // role: 'adminuser',
- // role: 'landlord',
- // role:''
- // role: 'customer'
- }
-
- export const login = () => {
- return {
- type: LOGIN
- }
- }
-
- // 异步的action
- export function asyncLogina() {
- console.log('asyncLogin22')
- return dispatch => {
- dispatch({
- type: 'LOGIN',
- data: '333'
- })
-
- }
- }
-
- export default function user(state = INITIAL_STATE, action) {
- console.log(state, 'state33')
- switch (action.type) {
- case 'LOGIN': {
-
- if (action.user.shopKeeperList.length > 0) {
- return {
- ...state,
- ...action.user,
- // role: 'landlord',
- role: 'customer',
- }
- } else {
- return {
- ...state,
- ...action.user,
- role: 'customer',
-
-
-
- }
- }
-
-
-
- }
- case 'phone': {
- return state
- }
-
- default:
- return state
- }
- }
|