Fix watchlist apis & add delete watchlist api

This commit is contained in:
Zoe Roux
2025-12-21 20:18:36 +01:00
parent 04fef7bd20
commit 6d21eeab07
7 changed files with 190 additions and 77 deletions
+17 -17
View File
@@ -70,19 +70,19 @@ export const ItemContext = ({
const { t } = useTranslation();
const mutation = useMutation({
path: [kind, slug, "watchStatus"],
path: ["api", `${kind}s`, slug, "watchstatus"],
compute: (newStatus: WatchStatusV | null) => ({
method: newStatus ? "POST" : "DELETE",
params: newStatus ? { status: newStatus } : undefined,
body: newStatus ? { status: newStatus } : undefined,
}),
invalidate: [kind, slug],
});
const metadataRefreshMutation = useMutation({
method: "POST",
path: [kind, slug, "refresh"],
invalidate: null,
});
// const metadataRefreshMutation = useMutation({
// method: "POST",
// path: [kind, slug, "refresh"],
// invalidate: null,
// });
return (
<Menu
@@ -127,16 +127,16 @@ export const ItemContext = ({
/>
</>
)}
{account?.isAdmin === true && (
<>
<HR />
<Menu.Item
label={t("home.refreshMetadata")}
icon={Refresh}
onSelect={() => metadataRefreshMutation.mutate()}
/>
</>
)}
{/* {account?.isAdmin === true && ( */}
{/* <> */}
{/* <HR /> */}
{/* <Menu.Item */}
{/* label={t("home.refreshMetadata")} */}
{/* icon={Refresh} */}
{/* onSelect={() => metadataRefreshMutation.mutate()} */}
{/* /> */}
{/* </> */}
{/* )} */}
</Menu>
);
};
@@ -46,7 +46,7 @@ export const WatchListInfo = ({
const { t } = useTranslation();
const mutation = useMutation({
path: [kind, slug, "watchStatus"],
path: ["api", `${kind}s`, slug, "watchstatus"],
compute: (newStatus: WatchStatus | null) => ({
method: newStatus ? "POST" : "DELETE",
body: newStatus ? { status: newStatus } : undefined,