Merge pull request 'Changes in Directory edit' (#407) from Kartik_Bug#1180 into Organization_Management
Reviewed-on: #407 Merged
This commit is contained in:
commit
4ea20981fc
@ -23,7 +23,6 @@ const ManageBucket1 = () => {
|
|||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
setAction(null);
|
setAction(null);
|
||||||
setSelectedBucket(null);
|
setSelectedBucket(null);
|
||||||
setDeleteId(null);
|
|
||||||
};
|
};
|
||||||
const { mutate: createBucket, isPending: creating } = useCreateBucket(() => {
|
const { mutate: createBucket, isPending: creating } = useCreateBucket(() => {
|
||||||
handleClose();
|
handleClose();
|
||||||
@ -49,23 +48,26 @@ const ManageBucket1 = () => {
|
|||||||
<p className="fs-5 fw-semibold m-0">Manage Buckets</p>
|
<p className="fs-5 fw-semibold m-0">Manage Buckets</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{action == "create" ? (
|
{action ? (
|
||||||
<>
|
<>
|
||||||
<BucketForm
|
{action && (
|
||||||
selectedBucket={selectedBucket}
|
<div>
|
||||||
mode={action} // pass create | edit
|
<BucketForm
|
||||||
onSubmit={handleSubmit}
|
selectedBucket={selectedBucket}
|
||||||
onCancel={() => {
|
mode={action} // pass create | edit
|
||||||
setAction(null);
|
onSubmit={handleSubmit}
|
||||||
setSelectedBucket(null);
|
onCancel={() => {
|
||||||
}}
|
setAction(null);
|
||||||
isPending={creating || updating}
|
setSelectedBucket(null);
|
||||||
/>
|
}}
|
||||||
{action === "edit" && selectedBucket && (
|
isPending={creating || updating}
|
||||||
<AssignedBucket
|
/>
|
||||||
selectedBucket={selectedBucket}
|
{action === "edit" && (
|
||||||
handleClose={handleClose}
|
<AssignedBucket
|
||||||
/>
|
selectedBucket={selectedBucket}
|
||||||
|
handleClose={handleClose}
|
||||||
|
/>)}
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
@ -91,11 +93,19 @@ const ManageBucket1 = () => {
|
|||||||
buckets={data}
|
buckets={data}
|
||||||
loading={isLoading}
|
loading={isLoading}
|
||||||
searchTerm={searchTerm}
|
searchTerm={searchTerm}
|
||||||
onDelete={(id) => setDeleteBucket({isOpen:true,bucketId:id})}
|
onDelete={(id) => setDeleteBucket({ isOpen: true, bucketId: id })}
|
||||||
|
onEdit={(b) => {
|
||||||
|
setAction("edit")
|
||||||
|
setSelectedBucket(b)
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default ManageBucket1;
|
export default ManageBucket1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -399,11 +399,13 @@ export const useUpdateBucket = (onSuccessCallBack) => {
|
|||||||
mutationFn: async ({ bucketId, BucketPayload }) =>
|
mutationFn: async ({ bucketId, BucketPayload }) =>
|
||||||
await DirectoryRepository.UpdateBuckets(bucketId, BucketPayload),
|
await DirectoryRepository.UpdateBuckets(bucketId, BucketPayload),
|
||||||
onSuccess: (_, variables) => {
|
onSuccess: (_, variables) => {
|
||||||
|
debugger;
|
||||||
queryClient.invalidateQueries({ queryKey: ["bucketList"] });
|
queryClient.invalidateQueries({ queryKey: ["bucketList"] });
|
||||||
showToast("Bucket updated successfully", "success");
|
showToast("Bucket updated successfully", "success");
|
||||||
if (onSuccessCallBack) onSuccessCallBack();
|
if (onSuccessCallBack) onSuccessCallBack();
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
|
debugger;
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message ||
|
error?.response?.data?.message ||
|
||||||
"Something went wrong. Please try again later.",
|
"Something went wrong. Please try again later.",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user