From f2d8aee6a90369ea450afb0e6ddb1192869461ea Mon Sep 17 00:00:00 2001 From: Swapnil Bendal <84583651+Swapnil155@users.noreply.github.com> Date: Mon, 20 Jan 2025 20:13:30 +0530 Subject: [PATCH] Refactor DeletionRequestApprove component to include refetch functionality and improve error handling --- .../AccountDeletion/DeletionRequestApprove.jsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Pages/AccountDeletion/DeletionRequestApprove.jsx b/src/Pages/AccountDeletion/DeletionRequestApprove.jsx index 124ffd2..c29211e 100644 --- a/src/Pages/AccountDeletion/DeletionRequestApprove.jsx +++ b/src/Pages/AccountDeletion/DeletionRequestApprove.jsx @@ -33,6 +33,7 @@ import { useGetDrawalRequestQuery } from "../../Services/drawal.request.service" import { useApproveDepositRequestMutation, useGetDeleteRequestByIdQuery, + useGetDeleteRequestQuery, } from "../../Services/delete.request.service"; const FILE_TYPES = ["image/jpeg", "image/png", "image/gif"]; @@ -75,6 +76,8 @@ const DeletionRequestApprove = ({ mode: "all", }); + const { refetch } = useGetDeleteRequestQuery(); + useEffect(() => { reset({ comment: fileredData?.comment, @@ -103,9 +106,12 @@ const DeletionRequestApprove = ({ toast({ render: () => , }); + refetch(); heandleOnClose(); } - } catch (error) {} + } catch (error) { + console.log(error); + } }; const onReject = () => {}; @@ -187,7 +193,10 @@ const DeletionRequestApprove = ({ )} - Maximum length should be 200 characters. You have entered + + {" "} + Maximum length should be 200 characters. You have entered + {watch("adminComment")?.length || 0} characters. @@ -199,8 +208,8 @@ const DeletionRequestApprove = ({ type="submit" size={"sm"} rounded={"sm"} - variant={'ghost'} - onClick={()=> setIsReject(true)} + variant={"ghost"} + onClick={() => setIsReject(true)} isLoading={isBtnLoadingReject} fontWeight={500} >