17 lines
420 B
JavaScript
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: '',
|
|
};
|
|
}
|