diff --git a/lib/client/listActions.ts b/lib/client/listActions.ts index 8c9bee0..01288ae 100644 --- a/lib/client/listActions.ts +++ b/lib/client/listActions.ts @@ -1,5 +1,6 @@ import { ListGridType } from "ant-design-vue/es/list"; import { FavPayload, HidePayload, SubPayload } from "./types/form/favSub"; +import { useRoute, useRouter } from "#app"; const base = `/user/me`; @@ -21,12 +22,20 @@ export const favourites = (values: (any & { _id: number })[], id: number, remove }); }; -export const subscriptions = (values: (any & { _id: number })[], id: number, action: "hide" | "subscribe" | "unsubscribe", type: "bands" | "authors") => { - values?.splice( - values!.findIndex((a) => a._id == id), - 1, - ); +export const subscriptions = ( + values: ((any & { _id: number }) | number)[], + id: number, + action: "hide" | "subscribe" | "unsubscribe", + type: "bands" | "authors", +) => { + const rtr = useRouter(); + console.log("subby", values); + if (action == "hide") { + values?.splice( + values!.findIndex((a) => a._id == id || a == id), + 1, + ); useApiFetch(`${base}/${action}`, { body: { push: {