2023-03-29 10:07:34 +03:00

17 lines
420 B
JavaScript

import { useStore } from '@/stores/hooks';
export function useValidation(elementName) {
const { $calculation, $process } = useStore();
const hasErrors = $calculation.$validation?.[elementName]?.hasErrors;
if (hasErrors) {
return {
help: 'Некорректные данные',
validateStatus: $process.has('Unlimited') ? 'warning' : 'error',
};
}
return {
validateStatus: '',
};
}