Replace mutation error types with AxiosError

This commit is contained in:
jeffvli 2023-05-09 05:53:57 -07:00
parent 3efeaa7359
commit a19673d3c2
10 changed files with 21 additions and 21 deletions

View File

@ -1,5 +1,5 @@
import { useQueryClient, useMutation } from '@tanstack/react-query'; import { useQueryClient, useMutation } from '@tanstack/react-query';
import { HTTPError } from 'ky'; import { AxiosError } from 'axios';
import { api } from '/@/renderer/api'; import { api } from '/@/renderer/api';
import { NDAlbumDetail, NDAlbumArtistDetail } from '/@/renderer/api/navidrome.types'; import { NDAlbumDetail, NDAlbumArtistDetail } from '/@/renderer/api/navidrome.types';
import { queryKeys } from '/@/renderer/api/query-keys'; import { queryKeys } from '/@/renderer/api/query-keys';
@ -22,7 +22,7 @@ export const useUpdateRating = () => {
return useMutation< return useMutation<
RatingResponse, RatingResponse,
HTTPError, AxiosError,
Omit<SetRatingArgs, 'server' | 'apiClientProps'>, Omit<SetRatingArgs, 'server' | 'apiClientProps'>,
{ previous: { items: AnyLibraryItems } | undefined } { previous: { items: AnyLibraryItems } | undefined }
>({ >({

View File

@ -1,5 +1,5 @@
import { useMutation } from '@tanstack/react-query'; import { useMutation } from '@tanstack/react-query';
import { HTTPError } from 'ky'; import { AxiosError } from 'axios';
import { api } from '/@/renderer/api'; import { api } from '/@/renderer/api';
import { ScrobbleResponse, ScrobbleArgs } from '/@/renderer/api/types'; import { ScrobbleResponse, ScrobbleArgs } from '/@/renderer/api/types';
import { MutationOptions } from '/@/renderer/lib/react-query'; import { MutationOptions } from '/@/renderer/lib/react-query';
@ -10,7 +10,7 @@ export const useSendScrobble = (options?: MutationOptions) => {
return useMutation< return useMutation<
ScrobbleResponse, ScrobbleResponse,
HTTPError, AxiosError,
Omit<ScrobbleArgs, 'server' | 'apiClientProps'>, Omit<ScrobbleArgs, 'server' | 'apiClientProps'>,
null null
>({ >({

View File

@ -1,5 +1,5 @@
import { useMutation, useQueryClient } from '@tanstack/react-query'; import { useMutation, useQueryClient } from '@tanstack/react-query';
import { HTTPError } from 'ky'; import { AxiosError } from 'axios';
import { api } from '/@/renderer/api'; import { api } from '/@/renderer/api';
import { queryKeys } from '/@/renderer/api/query-keys'; import { queryKeys } from '/@/renderer/api/query-keys';
import { AddToPlaylistArgs, AddToPlaylistResponse } from '/@/renderer/api/types'; import { AddToPlaylistArgs, AddToPlaylistResponse } from '/@/renderer/api/types';
@ -12,7 +12,7 @@ export const useAddToPlaylist = (args: MutationHookArgs) => {
return useMutation< return useMutation<
AddToPlaylistResponse, AddToPlaylistResponse,
HTTPError, AxiosError,
Omit<AddToPlaylistArgs, 'server' | 'apiClientProps'>, Omit<AddToPlaylistArgs, 'server' | 'apiClientProps'>,
null null
>({ >({

View File

@ -1,9 +1,9 @@
import { useMutation, useQueryClient } from '@tanstack/react-query'; import { useMutation, useQueryClient } from '@tanstack/react-query';
import { HTTPError } from 'ky';
import { api } from '/@/renderer/api'; import { api } from '/@/renderer/api';
import { CreatePlaylistArgs, CreatePlaylistResponse } from '/@/renderer/api/types'; import { CreatePlaylistArgs, CreatePlaylistResponse } from '/@/renderer/api/types';
import { MutationHookArgs } from '/@/renderer/lib/react-query'; import { MutationHookArgs } from '/@/renderer/lib/react-query';
import { getServerById } from '/@/renderer/store'; import { getServerById } from '/@/renderer/store';
import { AxiosError } from 'axios';
import { queryKeys } from '../../../api/query-keys'; import { queryKeys } from '../../../api/query-keys';
export const useCreatePlaylist = (args: MutationHookArgs) => { export const useCreatePlaylist = (args: MutationHookArgs) => {
@ -12,7 +12,7 @@ export const useCreatePlaylist = (args: MutationHookArgs) => {
return useMutation< return useMutation<
CreatePlaylistResponse, CreatePlaylistResponse,
HTTPError, AxiosError,
Omit<CreatePlaylistArgs, 'server' | 'apiClientProps'>, Omit<CreatePlaylistArgs, 'server' | 'apiClientProps'>,
null null
>({ >({

View File

@ -1,5 +1,5 @@
import { useMutation, useQueryClient } from '@tanstack/react-query'; import { useMutation, useQueryClient } from '@tanstack/react-query';
import { HTTPError } from 'ky'; import { AxiosError } from 'axios';
import { api } from '/@/renderer/api'; import { api } from '/@/renderer/api';
import { queryKeys } from '/@/renderer/api/query-keys'; import { queryKeys } from '/@/renderer/api/query-keys';
import { DeletePlaylistArgs, DeletePlaylistResponse } from '/@/renderer/api/types'; import { DeletePlaylistArgs, DeletePlaylistResponse } from '/@/renderer/api/types';
@ -13,7 +13,7 @@ export const useDeletePlaylist = (args: MutationHookArgs) => {
return useMutation< return useMutation<
DeletePlaylistResponse, DeletePlaylistResponse,
HTTPError, AxiosError,
Omit<DeletePlaylistArgs, 'server' | 'apiClientProps'>, Omit<DeletePlaylistArgs, 'server' | 'apiClientProps'>,
null null
>({ >({

View File

@ -1,8 +1,8 @@
import { useMutation, useQueryClient } from '@tanstack/react-query'; import { useMutation, useQueryClient } from '@tanstack/react-query';
import { HTTPError } from 'ky'; import { AxiosError } from 'axios';
import { api } from '/@/renderer/api'; import { api } from '/@/renderer/api';
import { queryKeys } from '/@/renderer/api/query-keys'; import { queryKeys } from '/@/renderer/api/query-keys';
import { RemoveFromPlaylistResponse, RemoveFromPlaylistArgs } from '/@/renderer/api/types'; import { RemoveFromPlaylistArgs, RemoveFromPlaylistResponse } from '/@/renderer/api/types';
import { MutationOptions } from '/@/renderer/lib/react-query'; import { MutationOptions } from '/@/renderer/lib/react-query';
import { getServerById } from '/@/renderer/store'; import { getServerById } from '/@/renderer/store';
@ -11,7 +11,7 @@ export const useRemoveFromPlaylist = (options?: MutationOptions) => {
return useMutation< return useMutation<
RemoveFromPlaylistResponse, RemoveFromPlaylistResponse,
HTTPError, AxiosError,
Omit<RemoveFromPlaylistArgs, 'server' | 'apiClientProps'>, Omit<RemoveFromPlaylistArgs, 'server' | 'apiClientProps'>,
null null
>({ >({

View File

@ -1,5 +1,5 @@
import { useMutation, useQueryClient } from '@tanstack/react-query'; import { useMutation, useQueryClient } from '@tanstack/react-query';
import { HTTPError } from 'ky'; import { AxiosError } from 'axios';
import { api } from '/@/renderer/api'; import { api } from '/@/renderer/api';
import { queryKeys } from '/@/renderer/api/query-keys'; import { queryKeys } from '/@/renderer/api/query-keys';
import { UpdatePlaylistArgs, UpdatePlaylistResponse } from '/@/renderer/api/types'; import { UpdatePlaylistArgs, UpdatePlaylistResponse } from '/@/renderer/api/types';
@ -12,7 +12,7 @@ export const useUpdatePlaylist = (args: MutationHookArgs) => {
return useMutation< return useMutation<
UpdatePlaylistResponse, UpdatePlaylistResponse,
HTTPError, AxiosError,
Omit<UpdatePlaylistArgs, 'server' | 'apiClientProps'>, Omit<UpdatePlaylistArgs, 'server' | 'apiClientProps'>,
null null
>({ >({

View File

@ -1,5 +1,5 @@
import { useMutation, useQueryClient } from '@tanstack/react-query'; import { useMutation, useQueryClient } from '@tanstack/react-query';
import { HTTPError } from 'ky'; import { AxiosError } from 'axios';
import { api } from '/@/renderer/api'; import { api } from '/@/renderer/api';
import { queryKeys } from '/@/renderer/api/query-keys'; import { queryKeys } from '/@/renderer/api/query-keys';
import { import {
@ -20,7 +20,7 @@ export const useCreateFavorite = (args: MutationHookArgs) => {
return useMutation< return useMutation<
FavoriteResponse, FavoriteResponse,
HTTPError, AxiosError,
Omit<FavoriteArgs, 'server' | 'apiClientProps'>, Omit<FavoriteArgs, 'server' | 'apiClientProps'>,
null null
>({ >({

View File

@ -1,5 +1,5 @@
import { useMutation, useQueryClient } from '@tanstack/react-query'; import { useMutation, useQueryClient } from '@tanstack/react-query';
import { HTTPError } from 'ky'; import { AxiosError } from 'axios';
import { api } from '/@/renderer/api'; import { api } from '/@/renderer/api';
import { queryKeys } from '/@/renderer/api/query-keys'; import { queryKeys } from '/@/renderer/api/query-keys';
import { import {
@ -20,7 +20,7 @@ export const useDeleteFavorite = (args: MutationHookArgs) => {
return useMutation< return useMutation<
FavoriteResponse, FavoriteResponse,
HTTPError, AxiosError,
Omit<FavoriteArgs, 'server' | 'apiClientProps'>, Omit<FavoriteArgs, 'server' | 'apiClientProps'>,
null null
>({ >({

View File

@ -1,5 +1,5 @@
import { useMutation, useQueryClient } from '@tanstack/react-query'; import { useMutation, useQueryClient } from '@tanstack/react-query';
import { HTTPError } from 'ky'; import { AxiosError } from 'axios';
import { api } from '/@/renderer/api'; import { api } from '/@/renderer/api';
import { queryKeys } from '/@/renderer/api/query-keys'; import { queryKeys } from '/@/renderer/api/query-keys';
import { import {
@ -23,7 +23,7 @@ export const useSetRating = (args: MutationHookArgs) => {
return useMutation< return useMutation<
RatingResponse, RatingResponse,
HTTPError, AxiosError,
Omit<SetRatingArgs, 'server' | 'apiClientProps'>, Omit<SetRatingArgs, 'server' | 'apiClientProps'>,
{ previous: { items: AnyLibraryItems } | undefined } { previous: { items: AnyLibraryItems } | undefined }
>({ >({