import ActionType from '../../actions/types'
// khởi tạo một init state
const initialState = {
    isLoading: false,
}

// bắt từng action type
function GetJobOfUserReducer(state = initialState, action) {
    switch (action.type) {
        case ActionType.START_GET_JOB_OF_USER:
            return {
                ...state,
                isLoading: true,
            }

        case ActionType.GET_JOB_OF_USER_SUCCESS:
            return {
                isLoading: false,
            }
        case ActionType.GET_JOB_OF_USER_FAILED:
            return {
                ...state,
                isLoading: false,
            }
        case ActionType.START_POST_JOB_OF_USER:
            return {
                ...state,
                isLoading: true,
            }

        case ActionType.POST_JOB_OF_USER_SUCCESS:
            return {
                isLoading: false,
            }
        case ActionType.POST_JOB_OF_USER_FAILED:
            return {
                ...state,
                isLoading: false,
            }
        default:
            return state
    }
}

export default GetJobOfUserReducer