Files
Checkmate/client/src/pages/billing/Success.tsx
T

37 lines
1.1 KiB
TypeScript
Raw Normal View History

2025-12-02 00:20:09 +00:00
import { BasePage } from "@/components/design-elements";
import Stack from "@mui/material/Stack";
import CircularProgress from "@mui/material/CircularProgress";
import Typography from "@mui/material/Typography";
import { useTheme } from "@mui/material/styles";
import { Navigate, useSearchParams } from "react-router-dom";
import { useGet } from "@/hooks/UseApi";
import type { ApiResponse } from "@/hooks/UseApi";
2025-12-01 03:45:57 +00:00
const BillingSuccessPage = () => {
2025-12-02 00:20:09 +00:00
const theme = useTheme();
const [searchParams] = useSearchParams();
const plan = searchParams.get("plan");
const { response } = useGet<ApiResponse<any>>(
`/billing/confirm?plan=${plan}`,
{},
{}
);
const success = response?.data?.success ?? false;
if (success === true) {
return <Navigate to="/billing" replace />;
} else {
return (
<BasePage>
<Stack direction="row" alignItems={"center"} gap={theme.spacing(10)}>
<CircularProgress color="accent" />
<Typography>Awaiting confirmation..</Typography>
</Stack>
</BasePage>
);
}
2025-12-01 03:45:57 +00:00
};
export default BillingSuccessPage;