This commit is contained in:
2026-01-21 21:31:32 -03:00
parent 26c3df876f
commit 37a9b20188
38 changed files with 1009 additions and 532 deletions

View File

@@ -11,7 +11,6 @@ import {
PlusIcon,
Trash2Icon
} from 'lucide-react'
import { pick } from 'ramda'
import { Fragment, use, useEffect, type ReactNode } from 'react'
import { Controller, useFieldArray, useForm } from 'react-hook-form'
import { Link, redirect, useFetcher, useParams } from 'react-router'
@@ -115,13 +114,14 @@ export async function loader({ params, context, request }: Route.LoaderArgs) {
export async function action({ params, request, context }: Route.ActionArgs) {
const { orgid: org_id } = params
const { subscription } = context.get(workspaceContext)
const body = (await request.json()) as object
const r = await req({
url: `enrollments`,
headers: new Headers({ 'Content-Type': 'application/json' }),
method: HttpMethod.POST,
body: JSON.stringify({ org_id, ...body }),
body: JSON.stringify({ org_id, subscription, ...body }),
request,
context
})
@@ -181,7 +181,10 @@ export default function Route({
'enrollments',
enrolled
.filter(({ status }) => status === 'fail')
.map(({ input_record }) => pick(['course', 'user'], input_record))
.map(({ input_record: { course, user } }) => ({
user,
course: { ...course, unit_price: 0 }
}))
)
}, [enrolled, setValue])