aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/src/apis/hooks/movies.ts
diff options
context:
space:
mode:
authorJayZed <[email protected]>2024-09-29 21:05:46 -0400
committerJayZed <[email protected]>2024-09-29 21:05:46 -0400
commitc2a1e4d62c1bbb372127a78e4419a96d3c00e81c (patch)
treeaf19b97bbb71b514ef39928e55769fa85064e23a /frontend/src/apis/hooks/movies.ts
parent4cc6806193127f9d6d3f2dab26969471d9bbf159 (diff)
parent0200bb96d98127ee32b6b66f8d6b9e21d4571a4d (diff)
downloadbazarr-c2a1e4d62c1bbb372127a78e4419a96d3c00e81c.tar.gz
bazarr-c2a1e4d62c1bbb372127a78e4419a96d3c00e81c.zip
Merge branch 'development' of https://github.com/morpheus65535/bazarr into developmentv1.4.5-beta.7
Diffstat (limited to 'frontend/src/apis/hooks/movies.ts')
-rw-r--r--frontend/src/apis/hooks/movies.ts33
1 files changed, 9 insertions, 24 deletions
diff --git a/frontend/src/apis/hooks/movies.ts b/frontend/src/apis/hooks/movies.ts
index cf4594cbe..6b1c5c2a5 100644
--- a/frontend/src/apis/hooks/movies.ts
+++ b/frontend/src/apis/hooks/movies.ts
@@ -15,23 +15,6 @@ const cacheMovies = (client: QueryClient, movies: Item.Movie[]) => {
});
};
-export function useMoviesByIds(ids: number[]) {
- const client = useQueryClient();
-
- const query = useQuery({
- queryKey: [QueryKeys.Movies, ...ids],
- queryFn: () => api.movies.movies(ids),
- });
-
- useEffect(() => {
- if (query.isSuccess && query.data) {
- cacheMovies(client, query.data);
- }
- }, [query.isSuccess, query.data, client]);
-
- return query;
-}
-
export function useMovieById(id: number) {
return useQuery({
queryKey: [QueryKeys.Movies, id],
@@ -74,12 +57,13 @@ export function useMovieModification() {
onSuccess: (_, form) => {
form.id.forEach((v) => {
- client.invalidateQueries({
+ void client.invalidateQueries({
queryKey: [QueryKeys.Movies, v],
});
});
+
// TODO: query less
- client.invalidateQueries({
+ void client.invalidateQueries({
queryKey: [QueryKeys.Movies],
});
},
@@ -93,7 +77,7 @@ export function useMovieAction() {
mutationFn: (form: FormType.MoviesAction) => api.movies.action(form),
onSuccess: () => {
- client.invalidateQueries({
+ void client.invalidateQueries({
queryKey: [QueryKeys.Movies],
});
},
@@ -125,10 +109,11 @@ export function useMovieAddBlacklist() {
},
onSuccess: (_, { id }) => {
- client.invalidateQueries({
+ void client.invalidateQueries({
queryKey: [QueryKeys.Movies, QueryKeys.Blacklist],
});
- client.invalidateQueries({
+
+ void client.invalidateQueries({
queryKey: [QueryKeys.Movies, id],
});
},
@@ -143,8 +128,8 @@ export function useMovieDeleteBlacklist() {
mutationFn: (param: { all?: boolean; form?: FormType.DeleteBlacklist }) =>
api.movies.deleteBlacklist(param.all, param.form),
- onSuccess: (_, param) => {
- client.invalidateQueries({
+ onSuccess: () => {
+ void client.invalidateQueries({
queryKey: [QueryKeys.Movies, QueryKeys.Blacklist],
});
},