Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation on how to protect page with specific Stripe Subscription #1812

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vishwamartur
Copy link

Related to #1041

Add documentation and code changes to protect a page with a specific Stripe Subscription.

  • README.md:

    • Add a new section explaining how to protect a page with a specific Stripe Subscription.
    • Include code examples for checking active Stripe Subscription in middleware.ts and AccessControl.tsx.
  • components/shared/AccessControl.tsx:

    • Import useActiveSubscription hook.
    • Add a check for active Stripe Subscription in the useCanAccess hook.
    • Update the AccessControl component to include the new check.
  • middleware.ts:

    • Import getByCustomerId from models/subscription.
    • Add a check for active Stripe Subscription before allowing access to protected routes.
    • Update the redirectUrl logic to handle subscription-based access control.

…ption

Related to boxyhq#1041

Add documentation and code changes to protect a page with a specific Stripe Subscription.

* **README.md**:
  - Add a new section explaining how to protect a page with a specific Stripe Subscription.
  - Include code examples for checking active Stripe Subscription in `middleware.ts` and `AccessControl.tsx`.

* **components/shared/AccessControl.tsx**:
  - Import `useActiveSubscription` hook.
  - Add a check for active Stripe Subscription in the `useCanAccess` hook.
  - Update the `AccessControl` component to include the new check.

* **middleware.ts**:
  - Import `getByCustomerId` from `models/subscription`.
  - Add a check for active Stripe Subscription before allowing access to protected routes.
  - Update the `redirectUrl` logic to handle subscription-based access control.
Copy link

vercel bot commented Oct 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
saas-starter-kit ❌ Failed (Inspect) Oct 30, 2024 6:50am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant