Merge pull request 'Changes in Directory edit' (#407) from Kartik_Bug#1180 into Organization_Management

Reviewed-on: #407
Merged
This commit is contained in:
pramod.mahajan 2025-09-29 09:00:27 +00:00
commit 4ea20981fc
2 changed files with 30 additions and 18 deletions

View File

@ -23,7 +23,6 @@ const ManageBucket1 = () => {
const handleClose = () => {
setAction(null);
setSelectedBucket(null);
setDeleteId(null);
};
const { mutate: createBucket, isPending: creating } = useCreateBucket(() => {
handleClose();
@ -49,8 +48,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 +62,12 @@ const ManageBucket1 = () => {
}}
isPending={creating || updating}
/>
{action === "edit" && selectedBucket && (
{action === "edit" && (
<AssignedBucket
selectedBucket={selectedBucket}
handleClose={handleClose}
/>
/>)}
</div>
)}
</>
) : (
@ -91,11 +93,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,11 +399,13 @@ 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.",