mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-02 10:53:33 +00:00
Refactor remaining queries/mutations for new controller
This commit is contained in:
parent
40aabd2217
commit
bdd023fde3
15 changed files with 92 additions and 109 deletions
|
|
@ -10,7 +10,12 @@ export const useUpdatePlaylist = (args: MutationHookArgs) => {
|
|||
const { options } = args || {};
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation<UpdatePlaylistResponse, HTTPError, Omit<UpdatePlaylistArgs, 'server'>, null>({
|
||||
return useMutation<
|
||||
UpdatePlaylistResponse,
|
||||
HTTPError,
|
||||
Omit<UpdatePlaylistArgs, 'server' | 'apiClientProps'>,
|
||||
null
|
||||
>({
|
||||
mutationFn: (args) => {
|
||||
const server = getServerById(args.serverId);
|
||||
if (!server) throw new Error('Server not found');
|
||||
|
|
@ -18,6 +23,9 @@ export const useUpdatePlaylist = (args: MutationHookArgs) => {
|
|||
},
|
||||
onSuccess: (_data, variables) => {
|
||||
const { query, serverId } = variables;
|
||||
|
||||
if (!serverId) return;
|
||||
|
||||
queryClient.invalidateQueries(queryKeys.playlists.list(serverId));
|
||||
|
||||
if (query?.id) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue