import { MenuEntry } from "@islands/KMenu/types.ts"; import { fetchStream } from "@lib/helpers.ts"; import { getCookie } from "@lib/string.ts"; export const updateAllRecommendations: MenuEntry = { title: "Update all recommendations", meta: "", icon: "IconSquareRoundedPlus", cb: (state) => { state.activeState.value = "loading"; fetchStream("/api/recommendation/all", (chunk) => { if (chunk.toLowerCase().includes("finish")) { setTimeout(() => { window.location.reload(); }, 500); } else { state.loadingText.value = chunk; } }); }, visible: () => { if (!getCookie("session_cookie")) return false; if ( !globalThis?.location?.pathname?.includes("movies") ) return false; return true; }, };