You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
591 B
25 lines
591 B
import _ from 'lodash';
|
|
import { createSelector } from 'reselect';
|
|
import createAllArtistSelector from './createAllArtistSelector';
|
|
|
|
function createProfileInUseSelector(profileProp) {
|
|
return createSelector(
|
|
(state, { id }) => id,
|
|
createAllArtistSelector(),
|
|
(state) => state.settings.importLists.items,
|
|
(id, artist, lists) => {
|
|
if (!id) {
|
|
return false;
|
|
}
|
|
|
|
if (_.some(artist, { [profileProp]: id }) || _.some(lists, { [profileProp]: id })) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
);
|
|
}
|
|
|
|
export default createProfileInUseSelector;
|