add some reditects
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
||||
} from 'lucide-react'
|
||||
import { Fragment, useMemo } from 'react'
|
||||
import { Controller, useFieldArray, useForm } from 'react-hook-form'
|
||||
import { Link } from 'react-router'
|
||||
import { Link, redirect, useParams } from 'react-router'
|
||||
|
||||
import {
|
||||
Breadcrumb,
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
BreadcrumbPage,
|
||||
BreadcrumbSeparator
|
||||
} from '@repo/ui/components/ui/breadcrumb'
|
||||
import { Button } from '@repo/ui/components/ui/button'
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
@@ -35,8 +36,7 @@ import {
|
||||
import { Kbd } from '@repo/ui/components/ui/kbd'
|
||||
import { request as req } from '@repo/util/request'
|
||||
|
||||
import { Button } from '@repo/ui/components/ui/button'
|
||||
import { useParams } from 'react-router'
|
||||
import { workspaceContext } from '@/middleware/workspace'
|
||||
import { CoursePicker } from '../_.$orgid.enrollments.add/course-picker'
|
||||
import {
|
||||
formSchema,
|
||||
@@ -63,6 +63,12 @@ type Seat = {
|
||||
}
|
||||
|
||||
export async function loader({ request, params, context }: Route.LoaderArgs) {
|
||||
const { subscription } = context.get(workspaceContext)
|
||||
// If there's subscription for the org, redirect it
|
||||
if (subscription) {
|
||||
throw redirect('../enrollments/add')
|
||||
}
|
||||
|
||||
const seats = await req({
|
||||
url: `/orgs/${params.orgid}/seats`,
|
||||
request,
|
||||
|
||||
Reference in New Issue
Block a user