aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/src/modules/socketio/reducer.ts
diff options
context:
space:
mode:
authorJayZed <[email protected]>2024-07-08 17:33:43 -0400
committerJayZed <[email protected]>2024-07-08 17:33:43 -0400
commit4cc6806193127f9d6d3f2dab26969471d9bbf159 (patch)
treebfc90e4b55fa0f48f83e51c4e5947c1f7d7d7a2d /frontend/src/modules/socketio/reducer.ts
parentd875dc7733c901246881325ee3a84fe5d44b10b9 (diff)
parent5886c20c9c7929bf46836a99c2d9d4eb834638bd (diff)
downloadbazarr-4cc6806193127f9d6d3f2dab26969471d9bbf159.tar.gz
bazarr-4cc6806193127f9d6d3f2dab26969471d9bbf159.zip
Merge branch 'development' of https://github.com/morpheus65535/bazarr into development
Diffstat (limited to 'frontend/src/modules/socketio/reducer.ts')
-rw-r--r--frontend/src/modules/socketio/reducer.ts85
1 files changed, 53 insertions, 32 deletions
diff --git a/frontend/src/modules/socketio/reducer.ts b/frontend/src/modules/socketio/reducer.ts
index 403fc0ce0..d19ff87c4 100644
--- a/frontend/src/modules/socketio/reducer.ts
+++ b/frontend/src/modules/socketio/reducer.ts
@@ -1,9 +1,9 @@
+import { cleanNotifications, showNotification } from "@mantine/notifications";
import queryClient from "@/apis/queries";
import { QueryKeys } from "@/apis/queries/keys";
+import { notification, task } from "@/modules/task";
import { LOG } from "@/utilities/console";
import { setCriticalError, setOnlineStatus } from "@/utilities/event";
-import { cleanNotifications, showNotification } from "@mantine/notifications";
-import { notification, task } from "../task";
export function createDefaultReducer(): SocketIO.Reducer[] {
return [
@@ -27,7 +27,7 @@ export function createDefaultReducer(): SocketIO.Reducer[] {
update: (msg) => {
msg
.map((message) => notification.info("Notification", message))
- .forEach(showNotification);
+ .forEach((data) => showNotification(data));
},
},
{
@@ -40,13 +40,13 @@ export function createDefaultReducer(): SocketIO.Reducer[] {
update: (ids) => {
LOG("info", "Invalidating series", ids);
ids.forEach((id) => {
- queryClient.invalidateQueries([QueryKeys.Series, id]);
+ queryClient.invalidateQueries({ queryKey: [QueryKeys.Series, id] });
});
},
delete: (ids) => {
LOG("info", "Invalidating series", ids);
ids.forEach((id) => {
- queryClient.invalidateQueries([QueryKeys.Series, id]);
+ queryClient.invalidateQueries({ queryKey: [QueryKeys.Series, id] });
});
},
},
@@ -55,13 +55,13 @@ export function createDefaultReducer(): SocketIO.Reducer[] {
update: (ids) => {
LOG("info", "Invalidating movies", ids);
ids.forEach((id) => {
- queryClient.invalidateQueries([QueryKeys.Movies, id]);
+ queryClient.invalidateQueries({ queryKey: [QueryKeys.Movies, id] });
});
},
delete: (ids) => {
LOG("info", "Invalidating movies", ids);
ids.forEach((id) => {
- queryClient.invalidateQueries([QueryKeys.Movies, id]);
+ queryClient.invalidateQueries({ queryKey: [QueryKeys.Movies, id] });
});
},
},
@@ -78,10 +78,9 @@ export function createDefaultReducer(): SocketIO.Reducer[] {
id,
]);
if (episode !== undefined) {
- queryClient.invalidateQueries([
- QueryKeys.Series,
- episode.sonarrSeriesId,
- ]);
+ queryClient.invalidateQueries({
+ queryKey: [QueryKeys.Series, episode.sonarrSeriesId],
+ });
}
});
},
@@ -93,10 +92,9 @@ export function createDefaultReducer(): SocketIO.Reducer[] {
id,
]);
if (episode !== undefined) {
- queryClient.invalidateQueries([
- QueryKeys.Series,
- episode.sonarrSeriesId,
- ]);
+ queryClient.invalidateQueries({
+ queryKey: [QueryKeys.Series, episode.sonarrSeriesId],
+ });
}
});
},
@@ -105,83 +103,106 @@ export function createDefaultReducer(): SocketIO.Reducer[] {
key: "episode-wanted",
update: (ids) => {
// Find a better way to update wanted
- queryClient.invalidateQueries([QueryKeys.Episodes, QueryKeys.Wanted]);
+ queryClient.invalidateQueries({
+ queryKey: [QueryKeys.Episodes, QueryKeys.Wanted],
+ });
},
delete: () => {
- queryClient.invalidateQueries([QueryKeys.Episodes, QueryKeys.Wanted]);
+ queryClient.invalidateQueries({
+ queryKey: [QueryKeys.Episodes, QueryKeys.Wanted],
+ });
},
},
{
key: "movie-wanted",
update: (ids) => {
// Find a better way to update wanted
- queryClient.invalidateQueries([QueryKeys.Movies, QueryKeys.Wanted]);
+ queryClient.invalidateQueries({
+ queryKey: [QueryKeys.Movies, QueryKeys.Wanted],
+ });
},
delete: () => {
- queryClient.invalidateQueries([QueryKeys.Movies, QueryKeys.Wanted]);
+ queryClient.invalidateQueries({
+ queryKey: [QueryKeys.Movies, QueryKeys.Wanted],
+ });
},
},
{
key: "settings",
any: () => {
- queryClient.invalidateQueries([QueryKeys.System]);
+ queryClient.invalidateQueries({ queryKey: [QueryKeys.System] });
},
},
{
key: "languages",
any: () => {
- queryClient.invalidateQueries([QueryKeys.System, QueryKeys.Languages]);
+ queryClient.invalidateQueries({
+ queryKey: [QueryKeys.System, QueryKeys.Languages],
+ });
},
},
{
key: "badges",
any: () => {
- queryClient.invalidateQueries([QueryKeys.System, QueryKeys.Badges]);
+ queryClient.invalidateQueries({
+ queryKey: [QueryKeys.System, QueryKeys.Badges],
+ });
},
},
{
key: "movie-history",
any: () => {
- queryClient.invalidateQueries([QueryKeys.Movies, QueryKeys.History]);
+ queryClient.invalidateQueries({
+ queryKey: [QueryKeys.Movies, QueryKeys.History],
+ });
},
},
{
key: "movie-blacklist",
any: () => {
- queryClient.invalidateQueries([QueryKeys.Movies, QueryKeys.Blacklist]);
+ queryClient.invalidateQueries({
+ queryKey: [QueryKeys.Movies, QueryKeys.Blacklist],
+ });
},
},
{
key: "episode-history",
any: () => {
- queryClient.invalidateQueries([QueryKeys.Episodes, QueryKeys.History]);
+ queryClient.invalidateQueries({
+ queryKey: [QueryKeys.Episodes, QueryKeys.History],
+ });
},
},
{
key: "episode-blacklist",
any: () => {
- queryClient.invalidateQueries([
- QueryKeys.Episodes,
- QueryKeys.Blacklist,
- ]);
+ queryClient.invalidateQueries({
+ queryKey: [QueryKeys.Episodes, QueryKeys.Blacklist],
+ });
},
},
{
key: "reset-episode-wanted",
any: () => {
- queryClient.invalidateQueries([QueryKeys.Episodes, QueryKeys.Wanted]);
+ queryClient.invalidateQueries({
+ queryKey: [QueryKeys.Episodes, QueryKeys.Wanted],
+ });
},
},
{
key: "reset-movie-wanted",
any: () => {
- queryClient.invalidateQueries([QueryKeys.Movies, QueryKeys.Wanted]);
+ queryClient.invalidateQueries({
+ queryKey: [QueryKeys.Movies, QueryKeys.Wanted],
+ });
},
},
{
key: "task",
any: () => {
- queryClient.invalidateQueries([QueryKeys.System, QueryKeys.Tasks]);
+ queryClient.invalidateQueries({
+ queryKey: [QueryKeys.System, QueryKeys.Tasks],
+ });
},
},
];