UNPKG

@leancodepl/kratos

Version:

Headless React components library for building Ory Kratos authentication flows

33 lines 1.28 kB
import { OnRedirectHandler } from './continueWith'; export type ValidationErrorHandler<T> = (body: T) => void; type FlowErrorHandlerProps<T> = { /** * When the SDK returns an error indicating that the flow needs to be restarted, this function is called. * * @param useFlowId - If provided, the SDK should use this flow ID to not lose context of the flow. */ onRestartFlow: (useFlowId?: string) => void; /** * When the SDK returns a validation error, this function is called. The result should be used to update the * flow container. * * The function should return a FlowContainer or nothing. * * @param body - The body of the response. */ onValidationError: ValidationErrorHandler<T>; /** * This method is used to redirect the user to a different page. */ onRedirect: OnRedirectHandler; }; /** * Use this as the catch handler for all flow-related SDK calls, such as creating a login or submitting a login. * * * @param opts - The configuration object. */ export declare const handleFlowError: <T>(opts: FlowErrorHandlerProps<T>) => (err: unknown) => Promise<T | void>; export declare function toBody(response: Response): Promise<unknown>; export {}; //# sourceMappingURL=utils.d.ts.map