histo
This commit is contained in:
@@ -94,7 +94,15 @@ const SearchView = (props: RouteProps<{}>) => {
|
|||||||
const navigation = useNavigation();
|
const navigation = useNavigation();
|
||||||
const artistsQuery = useQuery(API.getAllArtists());
|
const artistsQuery = useQuery(API.getAllArtists());
|
||||||
const [searchQuery, setSearchQuery] = React.useState({} as searchProps);
|
const [searchQuery, setSearchQuery] = React.useState({} as searchProps);
|
||||||
const rawResult = useQuery(API.searchSongs(searchQuery));
|
const rawResult = useQuery(API.searchSongs(searchQuery), {
|
||||||
|
onSuccess() {
|
||||||
|
const artist =
|
||||||
|
artistsQuery?.data?.find(({ id }) => id == searchQuery.artist)?.name ??
|
||||||
|
'unknown artist';
|
||||||
|
searchQuery.query ? API.createSearchHistoryEntry(searchQuery.query, 'song') : null;
|
||||||
|
if (artist != 'unknown artist') API.createSearchHistoryEntry(artist, 'artist');
|
||||||
|
},
|
||||||
|
});
|
||||||
const userQuery = useQuery(API.getUserInfo());
|
const userQuery = useQuery(API.getUserInfo());
|
||||||
const likedSongs = useQuery(API.getLikedSongs());
|
const likedSongs = useQuery(API.getLikedSongs());
|
||||||
const { mutateAsync } = useLikeSongMutation();
|
const { mutateAsync } = useLikeSongMutation();
|
||||||
|
|||||||
Reference in New Issue
Block a user