@casual-simulation/aux-common
Version:
Common library for AUX projects
43 lines • 1.43 kB
TypeScript
import type { KnownErrorCodes } from '../rpc/ErrorCodes';
import type { ZodIssue } from 'zod';
export declare const EMAIL_FIELD = "email";
export declare const PARENT_EMAIL_FIELD = "parentEmail";
export declare const NAME_FIELD = "name";
export declare const DATE_OF_BIRTH_FIELD = "dateOfBirth";
export declare const DISPLAY_NAME_FIELD = "displayName";
export declare const TERMS_OF_SERVICE_FIELD = "termsOfService";
export declare const ADDRESS_FIELD = "address";
export declare const CODE_FIELD = "code";
export declare const REPORT_REASON_FIELD = "reportReason";
export declare const REPORT_REASON_TEXT_FIELD = "reportReasonText";
export declare const COM_ID_FIELD = "comId";
/**
* Defines a basic interface for a form error.
*/
export interface FormError {
/**
* The field that the error is for.
* If null, then the error is a general error and should be displayed at the bottom of the form.
*/
for: string;
/**
* The error code.
*/
errorCode: string;
/**
* The error message.
*/
errorMessage: string;
}
export interface GenericResponse {
success: boolean;
errorCode?: KnownErrorCodes;
errorMessage?: string;
issues?: ZodIssue[];
}
/**
* Gets the list of form errors that are applicable for the given response.
* @param response
*/
export declare function getFormErrors(response: GenericResponse): FormError[];
//# sourceMappingURL=FormError.d.ts.map