Skip to content

Commit

Permalink
lesog
Browse files Browse the repository at this point in the history
  • Loading branch information
JUNIORCO committed Sep 6, 2024
1 parent db8545d commit 956e159
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/components/create-pyng/create-pyng-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ type CreatePyngFormProps = {
userEmail: string | undefined;
clerkUserId: string | undefined;
stripeSubscriptionId: string | undefined;
stripeSetupSucceeded: boolean | undefined;
};

export default function CreatePyngForm({
userEmail,
clerkUserId,
stripeSubscriptionId,
stripeSetupSucceeded,
}: CreatePyngFormProps) {
const {
control,
Expand Down Expand Up @@ -49,7 +51,7 @@ export default function CreatePyngForm({
return;
}

if (!stripeSubscriptionId) {
if (!stripeSubscriptionId || !stripeSetupSucceeded) {
toast.error("Please set up billing to create Pyngs.", {
duration: 3500,
});
Expand Down
3 changes: 3 additions & 0 deletions app/components/create-pyng/create-pyng.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ export default function CreatePyng({
userEmail,
clerkUserId,
stripeSubscriptionId,
stripeSetupSucceeded,
}: {
userEmail: string | undefined;
clerkUserId: string | undefined;
stripeSubscriptionId: string | undefined;
stripeSetupSucceeded: boolean | undefined;
}) {
return (
<div className="flex flex-col gap-4">
Expand All @@ -19,6 +21,7 @@ export default function CreatePyng({
userEmail={userEmail}
clerkUserId={clerkUserId}
stripeSubscriptionId={stripeSubscriptionId}
stripeSetupSucceeded={stripeSetupSucceeded}
/>
</div>
);
Expand Down
3 changes: 3 additions & 0 deletions app/page-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ type HomePageContentProps = {
clerkUserId: string | undefined;
stripeSubscriptionId: string | undefined;
stripeCustomerId: string | undefined;
stripeSetupSucceeded: boolean | undefined;
};

export default function HomePageContent({
userEmail,
clerkUserId,
stripeSubscriptionId,
stripeCustomerId,
stripeSetupSucceeded,
}: HomePageContentProps) {
const methods = useForm<IFormInput>({
defaultValues: {
Expand All @@ -45,6 +47,7 @@ export default function HomePageContent({
userEmail={userEmail}
clerkUserId={clerkUserId}
stripeSubscriptionId={stripeSubscriptionId}
stripeSetupSucceeded={stripeSetupSucceeded}
/>
<PopularPyngs userEmail={userEmail} />
</FormProvider>
Expand Down
4 changes: 4 additions & 0 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ export default function HomePage() {
const stripeCustomerId = user?.publicMetadata.stripeCustomerId as
| string
| undefined;
const stripeSetupSucceeded = user?.publicMetadata.stripeSetupSucceeded as
| boolean
| undefined;

return (
<HomePageContent
userEmail={userEmail}
clerkUserId={clerkUserId}
stripeSubscriptionId={stripeSubscriptionId}
stripeCustomerId={stripeCustomerId}
stripeSetupSucceeded={stripeSetupSucceeded}
/>
);
}

0 comments on commit 956e159

Please sign in to comment.