diff --git a/src/lib/api/useSetPlaylistMembership.ts b/src/lib/api/useSetPlaylistMembership.ts deleted file mode 100644 index 9aa6257d9..000000000 --- a/src/lib/api/useSetPlaylistMembership.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { QueryKey, useMutation, useQueryClient } from '@tanstack/react-query'; - -import { setPlaylistMembership } from '~lib/api/setPlaylistMembership'; -import { Scalars } from '~src/__generated__/graphql'; - -interface MutateVariables { - recordingId: Scalars['ID']['output']; - playlistId: Scalars['ID']['output']; - add: boolean; -} - -type ReturnType = ( - recordingId: Scalars['ID']['output'], - playlistId: Scalars['ID']['output'], - add: boolean, -) => void; - -export function useSetPlaylistMembership( - cacheKey: QueryKey | undefined = undefined, -): ReturnType { - const queryClient = useQueryClient(); - const { mutate } = useMutation({ - mutationFn: (variables: MutateVariables): Promise => { - const { recordingId, playlistId, add } = variables; - return setPlaylistMembership(recordingId, playlistId, add); - }, - - onSettled: async () => { - await queryClient.invalidateQueries({ queryKey: cacheKey }); - }, - }); - - return ( - recordingId: Scalars['ID']['output'], - playlistId: Scalars['ID']['output'], - add: boolean, - ) => mutate({ recordingId, playlistId, add }); -}