implemented stripe for the cloud instance

This commit is contained in:
Daniel
2023-07-15 22:15:43 -04:00
parent 0b66e16123
commit f82582a0bd
29 changed files with 474 additions and 88 deletions
+7 -2
View File
@@ -11,18 +11,23 @@ interface Props {
export default function AuthRedirect({ children }: Props) {
const router = useRouter();
const { status } = useSession();
const { status, data } = useSession();
const [redirect, setRedirect] = useState(true);
useInitialData();
useEffect(() => {
if (!router.pathname.startsWith("/public")) {
if (
if (status === "authenticated" && data.user.isSubscriber === false) {
router.push("/subscribe").then(() => {
setRedirect(false);
});
} else if (
status === "authenticated" &&
(router.pathname === "/login" ||
router.pathname === "/register" ||
router.pathname === "/confirmation" ||
router.pathname === "/subscribe" ||
router.pathname === "/forgot")
) {
router.push("/").then(() => {