mirror of
https://github.com/Sosokker/B2D-Ventures.git
synced 2025-12-19 05:54:06 +01:00
Refactor ApplyBusiness component to set success state and update loader component
This commit is contained in:
parent
7764e4ea0b
commit
94368983d6
@ -24,6 +24,7 @@ export default function ApplyBusiness() {
|
||||
await sendApplication(transformedData);
|
||||
};
|
||||
const sendApplication = async (recvData: any) => {
|
||||
setSucess(false);
|
||||
const {
|
||||
data: { user },
|
||||
} = await supabase.auth.getUser();
|
||||
@ -66,6 +67,7 @@ export default function ApplyBusiness() {
|
||||
},
|
||||
])
|
||||
.select();
|
||||
setSucess(true);
|
||||
// console.table(data);
|
||||
Swal.fire({
|
||||
icon: error == null ? "success" : "error",
|
||||
@ -141,6 +143,7 @@ export default function ApplyBusiness() {
|
||||
}
|
||||
});
|
||||
}
|
||||
setSucess(false);
|
||||
} else {
|
||||
console.error("User ID is undefined.");
|
||||
}
|
||||
|
||||
@ -10,14 +10,14 @@ const loadingOption = {
|
||||
preserveAspectRatio: "xMidYMid slice",
|
||||
},
|
||||
};
|
||||
const successOption = {
|
||||
loop: false,
|
||||
autoplay: true,
|
||||
animationData: successData,
|
||||
rendererSettings: {
|
||||
preserveAspectRatio: "xMidYMid slice",
|
||||
},
|
||||
};
|
||||
// const successOption = {
|
||||
// loop: false,
|
||||
// autoplay: true,
|
||||
// animationData: successData,
|
||||
// rendererSettings: {
|
||||
// preserveAspectRatio: "xMidYMid slice",
|
||||
// },
|
||||
// };
|
||||
|
||||
interface LoaderProps {
|
||||
isSuccess: boolean;
|
||||
@ -25,15 +25,17 @@ interface LoaderProps {
|
||||
|
||||
export function Loader(props: LoaderProps) {
|
||||
return (
|
||||
<div className="fixed inset-0 flex items-center justify-center bg-white bg-opacity-10 backdrop-blur-sm z-50">
|
||||
<>
|
||||
{!props.isSuccess && (
|
||||
<Lottie options={loadingOption} height={200} width={200} />
|
||||
<div className="fixed inset-0 flex items-center justify-center bg-white bg-opacity-10 backdrop-blur-sm z-50">
|
||||
<Lottie options={loadingOption} height={200} width={200} />
|
||||
</div>
|
||||
)}
|
||||
{/* {!props.isSuccess ? (
|
||||
<Lottie options={loadingOption} height={200} width={200} />
|
||||
) : (
|
||||
<Lottie options={successOption} height={200} width={200} />
|
||||
)} */}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user