feat: refactor resource management by removing modal components and integrating functionality into tabs; add ResourceBlocksPanel for temporary deactivation of resources
This commit is contained in:
@@ -49,8 +49,11 @@ export function useResources(filters: ResourceFilters = {}) {
|
||||
onError: (e) => fail(e, 'افزودن منبع ناموفق بود'),
|
||||
});
|
||||
|
||||
// PATCH است و سرور هم واقعاً جزئی رفتار میکند (`array_key_exists` روی هر فیلد)،
|
||||
// پس `Partial`: تغییر فقط `active` نباید کلاینت را مجبور کند `name` را هم بفرستد
|
||||
// — فرستادنِ نامِ کهنه، تغییرِ همزمانِ نام را بازمیگرداند.
|
||||
const update = useMutation({
|
||||
mutationFn: ({ uuid, d }: { uuid: string; d: ResourcePayload }) =>
|
||||
mutationFn: ({ uuid, d }: { uuid: string; d: Partial<ResourcePayload> }) =>
|
||||
api.patch<ApiResponse<ClinicResource>>(`/api/v1/resource/${uuid}`, d),
|
||||
onSuccess: () => { toast.success('منبع بهروزرسانی شد'); invalidate(); },
|
||||
onError: (e) => fail(e, 'بهروزرسانی منبع ناموفق بود'),
|
||||
|
||||
Reference in New Issue
Block a user