update add investor
This commit is contained in:
@@ -223,7 +223,7 @@ const InvestorDetails = () => {
|
||||
|
||||
>
|
||||
{/* {item.KYCStatus ? "Completed" : "Not complete"} */}
|
||||
{item?.KYCStatus === true ? "Completed" : "NotCompleted"}
|
||||
{item?.KYCStatus === true ? "Completed" : "Not Completed"}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
|
||||
@@ -107,23 +107,27 @@ const AddInvestmentType = () => {
|
||||
isActive: isSwitchOn,
|
||||
};
|
||||
await updateInvestmentType({ data: formData, id }).then((response) => {
|
||||
if (response?.data?.statusCode === 200) {
|
||||
if (response?.data) {
|
||||
toast({
|
||||
render: () => <ToastBox message={response?.data?.message} />,
|
||||
render: () => (
|
||||
<ToastBox
|
||||
status={"success"}
|
||||
message={response?.data?.message}
|
||||
/>
|
||||
),
|
||||
});
|
||||
|
||||
setIsLoadingBtn(false);
|
||||
setAlert(false);
|
||||
navigate("/investment-type");
|
||||
} else {
|
||||
} else if (response?.error) {
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox message={"Something Went Wrong"} status={"error"} />
|
||||
<ToastBox
|
||||
status={"error"}
|
||||
message={response?.error?.data?.message}
|
||||
/>
|
||||
),
|
||||
});
|
||||
|
||||
setIsLoadingBtn(false);
|
||||
navigate("/investment-type");
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -139,22 +143,50 @@ const AddInvestmentType = () => {
|
||||
};
|
||||
|
||||
await createInvestmentType(formData).then((response) => {
|
||||
if (response?.data?.statusCode === 201) {
|
||||
toast({
|
||||
render: () => <ToastBox message={response?.data?.message} />,
|
||||
});
|
||||
// if (response?.data?.statusCode === 201) {
|
||||
// toast({
|
||||
// render: () => <ToastBox message={response?.data?.message} />,
|
||||
// });
|
||||
|
||||
setIsLoadingBtn(false);
|
||||
navigate("/investment-type");
|
||||
} else {
|
||||
// setIsLoadingBtn(false);
|
||||
// navigate("/investment-type");
|
||||
// } else {
|
||||
// toast({
|
||||
// render: () => (
|
||||
// <ToastBox message={"Something Went Wrong"} status={"error"} />
|
||||
// ),
|
||||
// });
|
||||
|
||||
// setIsLoadingBtn(false);
|
||||
// navigate("/investment-type");
|
||||
// }
|
||||
|
||||
if (response?.data) {
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox message={"Something Went Wrong"} status={"error"} />
|
||||
<ToastBox
|
||||
status={"success"}
|
||||
message={response?.data?.message}
|
||||
/>
|
||||
),
|
||||
});
|
||||
|
||||
setAlert(false);
|
||||
setIsLoadingBtn(false);
|
||||
navigate("/investment-type");
|
||||
} else if (response?.error) {
|
||||
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox
|
||||
status={"error"}
|
||||
message={response?.error.data.message}
|
||||
/>
|
||||
),
|
||||
});
|
||||
setAlert(false);
|
||||
setIsLoadingBtn(false);
|
||||
|
||||
// navigate("/investment-type");
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -314,9 +346,22 @@ const AddInvestmentType = () => {
|
||||
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"} pb={14}>
|
||||
{/* ===================== [Switch Button] ======================== */}
|
||||
|
||||
<Box display={"flex"} justifyContent={"space-between"} alignItems={"center"} mt={5} px={4} mb={5}>
|
||||
<Text fontSize={"sm"} mb={0} onClick={() => navigate(-1)} cursor={"pointer"}>
|
||||
<ArrowBackIcon fontSize={"xl"} me={2} />Add Details
|
||||
<Box
|
||||
display={"flex"}
|
||||
justifyContent={"space-between"}
|
||||
alignItems={"center"}
|
||||
mt={5}
|
||||
px={4}
|
||||
mb={5}
|
||||
>
|
||||
<Text
|
||||
fontSize={"sm"}
|
||||
mb={0}
|
||||
onClick={() => navigate(-1)}
|
||||
cursor={"pointer"}
|
||||
>
|
||||
<ArrowBackIcon fontSize={"xl"} me={2} />
|
||||
Add Details
|
||||
</Text>
|
||||
<SwitchButton isSwitchOn={isSwitchOn} setIsSwitchOn={setIsSwitchOn} />
|
||||
</Box>
|
||||
@@ -338,7 +383,11 @@ const AddInvestmentType = () => {
|
||||
isOpen={alert}
|
||||
onClose={() => setAlert(false)}
|
||||
alertHandler={handleConfirm}
|
||||
message={id ? "Are you sure you want to update this document?" : " Are you sure you want to add this document?"}
|
||||
message={
|
||||
id
|
||||
? "Are you sure you want to update this document?"
|
||||
: " Are you sure you want to add this document?"
|
||||
}
|
||||
isLoading={isLoadingBtn}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user