V2Wizard: Make useHas<target>TargetOnly hook re-usable
This refines `useHasIsoTargetOnly` hook into `useHasSpecificTargetOnly` hook which takes an image type as an argument and can be re-used for non-iso targets as well.
This commit is contained in:
parent
a8112410b6
commit
f48bfd7c21
3 changed files with 10 additions and 9 deletions
|
|
@ -0,0 +1,8 @@
|
|||
import { useAppSelector } from '../../../store/hooks';
|
||||
import { ImageTypes } from '../../../store/imageBuilderApi';
|
||||
import { selectImageTypes } from '../../../store/wizardSlice';
|
||||
|
||||
export const useHasSpecificTargetOnly = (target: ImageTypes) => {
|
||||
const environments = useAppSelector(selectImageTypes);
|
||||
return environments.length === 1 && environments.includes(target);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue