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.
 
 
 

39 lines
1.1 KiB

import { post, get, patch, del } from "./baseApi";
/**
* Function wrapping POST request for creating worktypes
* @param {string} color - color value of worktype
* @param {string} label - label text of worktype
*/
export function createWorktype(color, label) {
return post("/worktype/", { color, label }).then(resp =>
Promise.resolve(resp)
);
}
/**
* Function wrapping GET request for retreiving worktype data
* @param {string} uuid - worktype unique identifier
*/
export function getWorktype(uuid) {
return get(`/worktype/${uuid}/`).then(resp => Promise.resolve(resp));
}
/**
* Function wrapping PATCH request for updating worktype
* @param {string} uuid - worktype unique identifier
* @param {string} color - color value of worktype
*/
export function updateWorktype(uuid, color) {
return patch(`/worktype/${uuid}/`, { color }).then(resp =>
Promise.resolve(resp)
);
}
/**
* Function wrapping DELETE request for removing worktypes
* @param {string} uuid - worktype unique identifier
*/
export function deleteWorktype(uuid) {
return del(`/worktype/${uuid}`).then(resp => Promise.resolve(resp));
}