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.
74 lines
1.5 KiB
74 lines
1.5 KiB
import { |
|
IS_SENDING_WORKTYPE_REQUEST, |
|
SET_WORKTYPE_REQUEST_ERROR, |
|
CLEAR_WORKTYPE_REQUEST_ERROR, |
|
SET_WORKTYPE_REQUEST_SUCCESS, |
|
CLEAR_WORKTYPE_REQUEST_SUCCESS, |
|
SET_WORKTYPE_UUID, |
|
SET_FORM_WORKTYPE_COLOR, |
|
SET_FORM_WORKTYPE_LABEL |
|
} from "../../constants/worktype.constants"; |
|
import { parseError } from "../common.actions"; |
|
|
|
export function isSendingWorktypeRequest(sendingRequest) { |
|
return { |
|
type: IS_SENDING_WORKTYPE_REQUEST, |
|
data: sendingRequest |
|
}; |
|
} |
|
|
|
export function setWorktypeRequestError(exception) { |
|
let error = parseError(exception); |
|
if (error.label) { |
|
error["Label"] = error.label; |
|
delete error["label"]; |
|
} |
|
if (error.color) { |
|
error["Color"] = error.color; |
|
delete error["color"]; |
|
} |
|
return { |
|
type: SET_WORKTYPE_REQUEST_ERROR, |
|
data: error |
|
}; |
|
} |
|
|
|
export function clearWorktypeRequestError() { |
|
return { |
|
type: CLEAR_WORKTYPE_REQUEST_ERROR |
|
}; |
|
} |
|
|
|
export function setWorktypeRequestSuccess(response) { |
|
return { |
|
type: SET_WORKTYPE_REQUEST_SUCCESS, |
|
data: response.detail || response |
|
}; |
|
} |
|
|
|
export function clearWorktypeRequestSuccess() { |
|
return { |
|
type: CLEAR_WORKTYPE_REQUEST_SUCCESS |
|
}; |
|
} |
|
|
|
export function setWorktypeUUID(uuid) { |
|
return { |
|
type: SET_WORKTYPE_UUID, |
|
data: uuid |
|
}; |
|
} |
|
|
|
export function setFormWorktypeColor(color) { |
|
return { |
|
type: SET_FORM_WORKTYPE_COLOR, |
|
data: color |
|
}; |
|
} |
|
|
|
export function setFormWorktypeLabel(label) { |
|
return { |
|
type: SET_FORM_WORKTYPE_LABEL, |
|
data: label |
|
}; |
|
}
|
|
|