Changes in Directory edit

This commit is contained in:
Kartik Sharma 2025-09-19 11:07:37 +05:30 committed by pramod.mahajan
parent 61835cb189
commit 1c376fe91f
2 changed files with 31 additions and 18 deletions

View File

@ -49,8 +49,10 @@ const ManageBucket1 = () => {
<p className="fs-5 fw-semibold m-0">Manage Buckets</p>
</div>
{action == "create" ? (
{action ? (
<>
{action && (
<div>
<BucketForm
selectedBucket={selectedBucket}
mode={action} // pass create | edit
@ -61,11 +63,12 @@ const ManageBucket1 = () => {
}}
isPending={creating || updating}
/>
{action === "edit" && selectedBucket && (
{action === "edit" && (
<AssignedBucket
selectedBucket={selectedBucket}
handleClose={handleClose}
/>
/>)}
</div>
)}
</>
) : (
@ -91,11 +94,19 @@ const ManageBucket1 = () => {
buckets={data}
loading={isLoading}
searchTerm={searchTerm}
onDelete={(id) => setDeleteBucket({isOpen:true,bucketId:id})}
onDelete={(id) => setDeleteBucket({ isOpen: true, bucketId: id })}
onEdit={(b) => {
setAction("edit")
setSelectedBucket(b)
}}
/>
</>
)}
</div>
);
};
export default ManageBucket1;

View File

@ -399,14 +399,16 @@ export const useUpdateBucket = (onSuccessCallBack) => {
mutationFn: async ({ bucketId, BucketPayload }) =>
await DirectoryRepository.UpdateBuckets(bucketId, BucketPayload),
onSuccess: (_, variables) => {
debugger;
queryClient.invalidateQueries({ queryKey: ["bucketList"] });
showToast("Bucket updated successfully", "success");
if (onSuccessCallBack) onSuccessCallBack();
},
onError: (error) => {
debugger;
showToast(
error?.response?.data?.message ||
"Something went wrong. Please try again later.",
"kARTIK went wrong. Please try again later.",
"error"
);
},