feat: add a name and phone change from the Masters (#62)
All checks were successful
it-academy/dry-wash-pl/pipeline/head This commit looks good
it-academy/dry-wash-pl/pipeline/pr-main This commit looks good

This commit is contained in:
2025-01-18 16:06:27 +03:00
parent 3ea501161c
commit 4f92125e6d
6 changed files with 190 additions and 23 deletions

View File

@@ -68,7 +68,33 @@ const armService = () => {
return await response.json();
};
return { fetchOrders, fetchMasters, addMaster, deleteMaster };
const updateMaster = async ({
id,
name,
phone,
}: {
id: string;
name?: string;
phone?: string;
}) => {
const body = JSON.stringify({ name, phone });
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();
};
return { fetchOrders, fetchMasters, addMaster, deleteMaster, updateMaster };
};
export { armService, ArmEndpoints };