feat: add update status and masters (#67)
This commit is contained in:
@@ -72,6 +72,34 @@ const armService = () => {
|
||||
return await response.json();
|
||||
};
|
||||
|
||||
const updateOrders = async ({
|
||||
id,
|
||||
status,
|
||||
notes,
|
||||
masterId,
|
||||
}: {
|
||||
id: string;
|
||||
status?: string;
|
||||
notes?: string;
|
||||
masterId?: string;
|
||||
}) => {
|
||||
const body = JSON.stringify({ status, notes, masterId });
|
||||
|
||||
const response = await fetch(`${endpoint}${ArmEndpoints.MASTERS}/${id}`, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch update masters: ${response.status}`);
|
||||
}
|
||||
|
||||
return await response.json();
|
||||
};
|
||||
|
||||
const updateMaster = async ({
|
||||
id,
|
||||
name,
|
||||
@@ -98,7 +126,14 @@ const armService = () => {
|
||||
return await response.json();
|
||||
};
|
||||
|
||||
return { fetchOrders, fetchMasters, addMaster, deleteMaster, updateMaster };
|
||||
return {
|
||||
fetchOrders,
|
||||
fetchMasters,
|
||||
addMaster,
|
||||
deleteMaster,
|
||||
updateMaster,
|
||||
updateOrders,
|
||||
};
|
||||
};
|
||||
|
||||
export { armService, ArmEndpoints };
|
||||
|
||||
Reference in New Issue
Block a user