From 934010a0c1d092594ff6446544f58354a9fcfb17 Mon Sep 17 00:00:00 2001 From: Amaury Danis Cousandier Date: Tue, 9 Jan 2024 21:35:48 +0100 Subject: [PATCH] tsc pretty lint --- front/views/V2/SearchView.tsx | 48 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/front/views/V2/SearchView.tsx b/front/views/V2/SearchView.tsx index c272c30..c495569 100644 --- a/front/views/V2/SearchView.tsx +++ b/front/views/V2/SearchView.tsx @@ -10,7 +10,7 @@ import SearchHistory from '../../components/V2/SearchHistory'; import ScaffoldCC from '../../components/UI/ScaffoldCC'; import MusicItem from '../../components/UI/MusicItem'; import API from '../../API'; -import { useMutation, useQueryClient } from 'react-query'; +import { useMutation } from 'react-query'; import LoadingComponent from '../../components/Loading'; import ErrorView from '../ErrorView'; @@ -98,38 +98,38 @@ const SearchView = (props: RouteProps<{}>) => { const userQuery = useQuery(API.getUserInfo()); let result: any[] = []; - const { mutate } = useMutation( - (songId: number) => API.addLikedSong(songId), { - onSuccess: () => { + const { mutate } = useMutation((songId: number) => API.addLikedSong(songId), { + onSuccess: () => { rawResult.refetch(); - } - } - ); + }, + }); if (userQuery.isLoading) { - return + return ; } if (userQuery.isError) { - return + return ; } if (userQuery.isSuccess) { - result = rawResult.data?.map((song) => ({ - artist: - artists.data?.find((artist) => artist.id === song?.artist?.id)?.name ?? - 'unknown artist', - song: song?.name, - image: song?.cover, - level: song?.difficulties.chordcomplexity, - lastScore: song?.lastScore, - bestScore: song?.bestScore, - liked: song?.likedByUsers?.some((user) => user.userId === userQuery.data.id) ?? false, - onLike: () => { - mutate(song.id); - }, - onPlay: () => navigation.navigate('Play', { songId: song.id }), - })) ?? []; + result = + rawResult.data?.map((song) => ({ + artist: + artists.data?.find((artist) => artist.id === song?.artist?.id)?.name ?? + 'unknown artist', + song: song?.name, + image: song?.cover, + level: song?.difficulties.chordcomplexity, + lastScore: song?.lastScore, + bestScore: song?.bestScore, + liked: + song?.likedByUsers?.some((user) => user.userId === userQuery.data.id) ?? false, + onLike: () => { + mutate(song.id); + }, + onPlay: () => navigation.navigate('Play', { songId: song.id }), + })) ?? []; } return (