(
lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>,
...rest: MaybeOptionalOptions<
CreateProcedureClientOptions<
TInitialContext,
TOutputSchema,
TErrorMap,
TMeta,
Record<never, never>
>
>
)
| 28 | * @see {@link https://orpc.dev/docs/openapi/bracket-notation Bracket Notation Docs} |
| 29 | */ |
| 30 | export function createFormAction< |
| 31 | TInitialContext extends Context, |
| 32 | TInputSchema extends AnySchema, |
| 33 | TOutputSchema extends AnySchema, |
| 34 | TErrorMap extends ErrorMap, |
| 35 | TMeta extends Meta, |
| 36 | >( |
| 37 | lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, |
| 38 | ...rest: MaybeOptionalOptions< |
| 39 | CreateProcedureClientOptions< |
| 40 | TInitialContext, |
| 41 | TOutputSchema, |
| 42 | TErrorMap, |
| 43 | TMeta, |
| 44 | Record<never, never> |
| 45 | > |
| 46 | > |
| 47 | ): FormAction { |
| 48 | const options = resolveMaybeOptionalOptions(rest) |
| 49 | |
| 50 | const client = createProcedureClient(lazyableProcedure, { |
| 51 | ...options, |
| 52 | interceptors: [orpcErrorToNextHttpFallbackInterceptor, ...toArray(options.interceptors)], |
| 53 | }) |
| 54 | |
| 55 | const bracketNotation = new StandardBracketNotationSerializer() |
| 56 | |
| 57 | return async (form) => { |
| 58 | const input = bracketNotation.deserialize([...form]) |
| 59 | await client(input as any) |
| 60 | } |
| 61 | } |
no test coverage detected