stores: add hooks for stores
This commit is contained in:
parent
fc663b43d1
commit
951b847a8d
9
stores/calculation/options/hooks.js
Normal file
9
stores/calculation/options/hooks.js
Normal file
@ -0,0 +1,9 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
import { useStore } from 'stores/hooks';
|
||||
|
||||
export function useOptions(elementName) {
|
||||
const { $calculation } = useStore();
|
||||
return {
|
||||
options: $calculation.$options.getOptions(elementName),
|
||||
};
|
||||
}
|
||||
10
stores/calculation/statuses/hooks.js
Normal file
10
stores/calculation/statuses/hooks.js
Normal file
@ -0,0 +1,10 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
import { useStore } from 'stores/hooks';
|
||||
|
||||
export function useStatus(elementName) {
|
||||
const { $calculation } = useStore();
|
||||
const status = $calculation.$status.getStatus(elementName);
|
||||
return {
|
||||
status,
|
||||
};
|
||||
}
|
||||
8
stores/calculation/validation/hooks.js
Normal file
8
stores/calculation/validation/hooks.js
Normal file
@ -0,0 +1,8 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
import { useStore } from 'stores/hooks';
|
||||
|
||||
export function useValidation(elementName) {
|
||||
const { $calculation } = useStore();
|
||||
const validationResult = $calculation.$validation.getValidation(elementName);
|
||||
return validationResult;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user