25 lines
475 B
JavaScript
25 lines
475 B
JavaScript
import PhotosActionTypes from "./photos.types";
|
|
|
|
const INITIAL_STATE = {
|
|
photos: [],
|
|
uploadInProgress: false,
|
|
uploadError: null,
|
|
};
|
|
|
|
const photosReducer = (state = INITIAL_STATE, action) => {
|
|
switch (action.type) {
|
|
case PhotosActionTypes.MEDIA_UPLOAD_START:
|
|
return {
|
|
...state,
|
|
photos: action.payload,
|
|
uploadInProgress: true,
|
|
uploadError: null,
|
|
};
|
|
|
|
default:
|
|
return state;
|
|
}
|
|
};
|
|
|
|
export default photosReducer;
|