| 123456789101112131415161718192021 |
- import type {AssertRule} from "~/types/interfaces";
- import { useI18n } from 'vue-i18n';
- import ValidationUtils from "~/services/utils/validationUtils";
- export class TypeAssert implements AssertRule {
- supports(key: string): boolean {
- return key === 'type';
- }
- createRule(criteria: string): (value: any) => true | string {
- const validationUtils = new ValidationUtils()
- const { t } = useI18n();
- if (criteria === 'email') {
- return (email: string) =>
- validationUtils.validEmail(email) || t('email_error');
- }
- return () => true;
- }
- }
|