Files
astuto/app/javascript/helpers/formUtils.ts
Riccardo Graziosi 4c73b398e8 Add OAuth2 authentication (#147)
- Added Site settings > Authentication section
- Create/edit/delete your custom oauth2 configurations
- Login or signup with oauth2
2022-08-05 18:15:17 +02:00

20 lines
439 B
TypeScript

import { FieldError } from "react-hook-form";
import I18n from 'i18n-js';
export const getLabel = (
entity: string,
attribute: string,
) => (
I18n.t(`activerecord.attributes.${entity}.${attribute}`)
);
export const getValidationMessage = (
validationType: FieldError['type'],
entity: string,
attribute: string,
) => (
I18n.t(
`common.validations.${validationType}`,
{ attribute: getLabel(entity, attribute) }
)
);