17 lines
511 B
JavaScript
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);
|
|
}
|
|
}
|