fix redirect to checkout when the org has not a subscription
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user