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.
 
 
 

78 lines
1.6 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";
import { parseError } from "../common.actions";
export function isSendingPriceRequest(sendingRequest) {
return {
type: IS_SENDING_PRICE_REQUEST,
data: sendingRequest
};
}
export function setPriceRequestError(exception) {
let error = parseError(exception);
if (error.amount) {
error["Amount"] = error.amount;
delete error["amount"];
}
if (error.get_employee_uuid) {
error["Employee"] = error.get_employee_uuid;
delete error["get_employee_uuid"];
}
if (error.get_work_type_uuid) {
error["WorkType"] = error.get_work_type_uuid;
delete error["get_work_type_uuid"];
}
return {
type: SET_PRICE_REQUEST_ERROR,
data: error
};
}
export function clearPriceRequestError() {
return {
type: CLEAR_PRICE_REQUEST_ERROR
};
}
export function setPriceRequestSuccess(response) {
return {
type: SET_PRICE_REQUEST_SUCCESS,
data: response.detail || response
};
}
export function clearPriceRequestSuccess() {
return {
type: CLEAR_PRICE_REQUEST_SUCCESS
};
}
export function setGetEmployeeUUID(uuid) {
return {
type: SET_GET_EMPLOYEE_UUID,
data: uuid
};
}
export function setGetWorktypeUUID(uuid) {
return {
type: SET_GET_WORKTYPE_UUID,
data: uuid
};
}
export function setFormPriceAmount(amount) {
return {
type: SET_FORM_PRICE_AMOUNT,
data: amount
};
}