feat: update of partner
This commit is contained in:
3
src/store/actions/partner.ts
Normal file
3
src/store/actions/partner.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import { SET_INVITE_CODE } from '../constants';
|
||||
|
||||
export const setInviteCode = (value: string) => ({ type: SET_INVITE_CODE, value });
|
@ -4,3 +4,4 @@ export const SET_LOCATION_INFO = 'SET_LOCATION_INFO';
|
||||
export const SET_USER_INFO = 'SET_USER_INFO';
|
||||
export const SET_BIND_PHONE = 'SET_BIND_PHONE';
|
||||
export const SET_USER_MESSAGE = 'SET_USER_MESSAGE';
|
||||
export const SET_INVITE_CODE = 'SET_INVITE_CODE';
|
||||
|
@ -2,10 +2,12 @@ import { combineReducers } from 'redux';
|
||||
|
||||
import appState from './app';
|
||||
import message from './message';
|
||||
import partnerInfo from './partner';
|
||||
import userInfo from './user';
|
||||
|
||||
export default combineReducers({
|
||||
appState,
|
||||
userInfo,
|
||||
message,
|
||||
partnerInfo,
|
||||
});
|
||||
|
22
src/store/reducers/partner.ts
Normal file
22
src/store/reducers/partner.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { Action } from 'redux';
|
||||
|
||||
import { PartnerInfo } from '@/types/partner';
|
||||
|
||||
import { SET_INVITE_CODE } from '../constants';
|
||||
|
||||
const INIT_STATE: Partial<PartnerInfo> = {};
|
||||
|
||||
const partnerInfo = (state: Partial<PartnerInfo> = INIT_STATE, action: Action): Partial<PartnerInfo> => {
|
||||
const { type, value } = action as BL.Anything;
|
||||
switch (type) {
|
||||
case SET_INVITE_CODE: {
|
||||
return {
|
||||
inviteCode: value,
|
||||
};
|
||||
}
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
export default partnerInfo;
|
5
src/store/selector/partner.ts
Normal file
5
src/store/selector/partner.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { IState } from '@/types/store';
|
||||
|
||||
export const selectPartnerInfo = (state: IState) => {
|
||||
return state.partnerInfo;
|
||||
};
|
Reference in New Issue
Block a user