Files
dupe/client/src/stores/tvStore.js
2025-10-28 04:14:42 +03:00

17 lines
511 B
JavaScript

import { writable } from "svelte/store";
import { apiFetch } from "../utils/api.js";
export const tvShowCount = writable(0);
export async function refreshTvShowCount() {
try {
const resp = await apiFetch("/api/tvshows");
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
const list = await resp.json();
tvShowCount.set(Array.isArray(list) ? list.length : 0);
} catch (err) {
console.warn("⚠️ TV show count güncellenemedi:", err?.message || err);
tvShowCount.set(0);
}
}