You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.4 KiB
68 lines
1.4 KiB
import { |
|
IS_SENDING_PRICE_REQUEST, |
|
SET_PRICE_REQUEST_ERROR, |
|
CLEAR_PRICE_REQUEST_ERROR, |
|
SET_PRICE_REQUEST_SUCCESS, |
|
CLEAR_PRICE_REQUEST_SUCCESS, |
|
SET_GET_EMPLOYEE_UUID, |
|
SET_GET_WORKTYPE_UUID, |
|
SET_FORM_PRICE_AMOUNT |
|
} from "../constants/price.constants"; |
|
|
|
const initialState = { |
|
isSendingPriceRequest: false, |
|
priceRequestError: "", |
|
priceRequestSuccess: "", |
|
getEmployeeUUID: "", |
|
getWorktypeUUID: "", |
|
amount: "" |
|
}; |
|
|
|
function priceReducer(state = initialState, action) { |
|
switch (action.type) { |
|
case IS_SENDING_PRICE_REQUEST: |
|
return { |
|
...state, |
|
isSendingPriceRequest: action.data |
|
}; |
|
case SET_PRICE_REQUEST_ERROR: |
|
return { |
|
...state, |
|
priceRequestError: action.data |
|
}; |
|
case CLEAR_PRICE_REQUEST_ERROR: |
|
return { |
|
...state, |
|
priceRequestError: "" |
|
}; |
|
case SET_PRICE_REQUEST_SUCCESS: |
|
return { |
|
...state, |
|
priceRequestSuccess: action.data |
|
}; |
|
case CLEAR_PRICE_REQUEST_SUCCESS: |
|
return { |
|
...state, |
|
priceRequestSuccess: "" |
|
}; |
|
case SET_GET_EMPLOYEE_UUID: |
|
return { |
|
...state, |
|
getEmployeeUUID: action.data |
|
}; |
|
case SET_GET_WORKTYPE_UUID: |
|
return { |
|
...state, |
|
getWorktypeUUID: action.data |
|
}; |
|
case SET_FORM_PRICE_AMOUNT: |
|
return { |
|
...state, |
|
amount: action.data |
|
}; |
|
default: |
|
return state; |
|
} |
|
} |
|
|
|
export default priceReducer;
|
|
|