Base changes to job upload screen.
This commit is contained in:
24
client/src/redux/media/media.reducer.js
Normal file
24
client/src/redux/media/media.reducer.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import MediaActionTypes from "./media.types";
|
||||
|
||||
const INITIAL_STATE = { error: null };
|
||||
|
||||
const mediaReducer = (state = INITIAL_STATE, action) => {
|
||||
switch (action.type) {
|
||||
case MediaActionTypes.SET_MEDIA_FOR_JOB:
|
||||
return { ...state, [action.payload.jobid]: action.payload.media };
|
||||
case MediaActionTypes.GET_MEDIA_FOR_JOB_ERROR:
|
||||
return { ...state, error: action.payload };
|
||||
case MediaActionTypes.ADD_MEDIA_FOR_JOB:
|
||||
return {
|
||||
...state,
|
||||
[action.payload.jobid]: [
|
||||
...state[action.payload.jobid],
|
||||
...(action.payload.media || []),
|
||||
],
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
export default mediaReducer;
|
||||
Reference in New Issue
Block a user