Fix episodes are not updated after subtitle action

This commit is contained in:
LASER-Yi 2022-03-19 02:33:51 +08:00
parent 967795e1a6
commit 1520d6614b
No known key found for this signature in database
GPG Key ID: BB28903D50A1D408
2 changed files with 11 additions and 3 deletions

View File

@ -12,8 +12,16 @@ export function useSubtitleAction() {
[QueryKeys.Subtitles],
(param: Param) => api.subtitles.modify(param.action, param.form),
{
onSuccess: () => {
onSuccess: (_, param) => {
client.invalidateQueries([QueryKeys.History]);
// TODO: Query less
const { type, id } = param.form;
if (type === "episode") {
client.invalidateQueries([QueryKeys.Series, id]);
} else {
client.invalidateQueries([QueryKeys.Movies, id]);
}
},
}
);

View File

@ -4,7 +4,7 @@ declare namespace FormType {
profileid: (number | null)[];
}
type SeriesAction = OneSerieAction | SearchWantedAction;
type SeriesAction = OneSeriesAction | SearchWantedAction;
type MoviesAction = OneMovieAction | SearchWantedAction;
@ -13,7 +13,7 @@ declare namespace FormType {
radarrid: number;
}
interface OneSerieAction {
interface OneSeriesAction {
action: "search-missing" | "scan-disk";
seriesid: number;
}