diff --git a/src/Components/Profile/Subcomponents/GroupSubheaderForm.tsx b/src/Components/Profile/Subcomponents/GroupSubheaderForm.tsx index cd4084dd..afd43c2f 100644 --- a/src/Components/Profile/Subcomponents/GroupSubheaderForm.tsx +++ b/src/Components/Profile/Subcomponents/GroupSubheaderForm.tsx @@ -30,13 +30,16 @@ export const GroupSubheaderForm = ({ useEffect(() => { if (groupTypes && groupStates) { const groupType = groupTypes.find((gt) => gt.groupTypes_id.name === state.group_type) - // eslint-disable-next-line no-console - console.log(state.group_type) + const customImage = !groupTypes.some( + (gt) => gt.groupTypes_id.image === state.image || !state.image, + ) setState((prevState) => ({ ...prevState, color: groupType?.groupTypes_id.color || groupTypes[0].groupTypes_id.color, marker_icon: groupType?.groupTypes_id.markerIcon || groupTypes[0].groupTypes_id.markerIcon, - image: groupType?.groupTypes_id.image || groupTypes[0].groupTypes_id.image, + image: customImage + ? state.image + : groupType?.groupTypes_id.image || groupTypes[0].groupTypes_id.image, status: state.status || groupStates[0], group_type: state.group_type || groupTypes[0].groupTypes_id.name, }))