fix redirect to checkout when the org has not a subscription

This commit is contained in:
2026-01-07 14:30:29 -03:00
parent d222872000
commit ded57b43f0
7 changed files with 173 additions and 113 deletions

View File

@@ -72,6 +72,7 @@ import { ScheduledForInput } from './scheduled-for'
import { CoursePicker } from './course-picker'
import { UserPicker } from './user-picker'
import { cn } from '@repo/ui/lib/utils'
import { workspaceContext } from '@/middleware/workspace'
const emptyRow = {
user: undefined,
@@ -84,6 +85,12 @@ export function meta({}: Route.MetaArgs) {
}
export async function loader({ params, context, request }: Route.LoaderArgs) {
const { subscription } = context.get(workspaceContext)
// If there's no subscription for the org, redirect to checkout
if (!subscription) {
throw redirect('../enrollments/buy')
}
const url = new URL(request.url)
const submissionId = url.searchParams.get('submission')
const cloudflare = context.get(cloudflareContext)