feat: job publish
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
export * from './app';
|
||||
export * from './user';
|
||||
export * from './message';
|
||||
export * from './job';
|
||||
|
||||
7
src/store/actions/job.ts
Normal file
7
src/store/actions/job.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { CreateJobInfo } from '@/types/job';
|
||||
|
||||
import { CREATE_JOB } from '../constants';
|
||||
|
||||
export const cacheCreateJob = (value: CreateJobInfo) => ({ type: CREATE_JOB, value });
|
||||
|
||||
export const clearCachedJob = () => ({ type: CREATE_JOB, value: {} });
|
||||
@ -5,3 +5,4 @@ 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';
|
||||
export const CREATE_JOB = 'CREATE_JOB';
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { combineReducers } from 'redux';
|
||||
|
||||
import appState from './app';
|
||||
import jobState from './job';
|
||||
import message from './message';
|
||||
import partnerInfo from './partner';
|
||||
import userInfo from './user';
|
||||
@ -10,4 +11,5 @@ export default combineReducers({
|
||||
userInfo,
|
||||
message,
|
||||
partnerInfo,
|
||||
jobState,
|
||||
});
|
||||
|
||||
19
src/store/reducers/job.ts
Normal file
19
src/store/reducers/job.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { Action } from 'redux';
|
||||
|
||||
import { CreateJobInfo } from '@/types/job';
|
||||
|
||||
import { CREATE_JOB } from '../constants';
|
||||
|
||||
const INIT_STATE: Partial<CreateJobInfo> = {};
|
||||
|
||||
const userInfo = (state: Partial<CreateJobInfo> = INIT_STATE, action: Action): Partial<CreateJobInfo> => {
|
||||
const { type, value } = action as BL.Anything;
|
||||
switch (type) {
|
||||
case CREATE_JOB:
|
||||
return value;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
export default userInfo;
|
||||
3
src/store/selector/job.ts
Normal file
3
src/store/selector/job.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import { IState } from '@/types/store';
|
||||
|
||||
export const selectCreatedJob = (state: IState) => state.jobState;
|
||||
Reference in New Issue
Block a user