Changeset 299af01 for src/api/customer.ts
- Timestamp:
- 02/26/25 14:27:26 (6 weeks ago)
- Branches:
- main
- Children:
- 3c5302a
- Parents:
- 057453c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/api/customer.ts
r057453c r299af01 44 44 } 45 45 } 46 47 export async function updateCustomer( 48 id: string, 49 customerData: Partial<Customer> 50 ): Promise<Customer> { 51 try { 52 const response = await axios.patch<Customer>(`${endpoints.customer}/${id}`, customerData); 53 54 // Mutate the SWR cache to update the customer 55 await mutate<Customer[]>(endpoints.customer, (currentData = []) => 56 currentData.map((customer) => 57 customer.id === id ? { ...customer, ...response.data } : customer 58 ) 59 ); 60 61 return response.data; 62 } catch (error) { 63 throw error; 64 } 65 }
Note:
See TracChangeset
for help on using the changeset viewer.