Files
ProxmoxVE/frontend/src/lib/data.ts
2024-11-09 20:06:54 +01:00

11 lines
313 B
TypeScript

import { Category } from "./types";
export const fetchCategories = async () => {
const response = await fetch("api/categories");
if (!response.ok) {
throw new Error(`Failed to fetch categories: ${response.statusText}`);
}
const categories: Category[] = await response.json();
return categories;
};