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:
regexowl 2024-05-28 14:40:50 +02:00 committed by Sanne Raymaekers
parent a8112410b6
commit f48bfd7c21
3 changed files with 10 additions and 9 deletions

View file

@ -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);
};