17 lines
356 B
JavaScript
17 lines
356 B
JavaScript
import { useStore } from '@/stores/hooks';
|
|
|
|
export function useValidation(elementName) {
|
|
const { $calculation } = useStore();
|
|
const hasErrors = $calculation.$validation?.[elementName]?.hasErrors;
|
|
if (hasErrors) {
|
|
return {
|
|
help: 'Некорректные данные',
|
|
isValid: false,
|
|
};
|
|
}
|
|
|
|
return {
|
|
isValid: true,
|
|
};
|
|
}
|