19 lines
413 B
JavaScript
19 lines
413 B
JavaScript
/* eslint-disable import/prefer-default-export */
|
|
import { useStore } from 'stores/hooks';
|
|
|
|
export function useValidation(elementName) {
|
|
const { $calculation } = useStore();
|
|
const messages = $calculation.$validation[elementName]?.getMessages();
|
|
|
|
if (messages?.length) {
|
|
return {
|
|
isValid: false,
|
|
help: 'Некорректные данные',
|
|
};
|
|
}
|
|
|
|
return {
|
|
isValid: true,
|
|
};
|
|
}
|