Initial Release
This commit is contained in:
10
frontend/src/lib/data.ts
Normal file
10
frontend/src/lib/data.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
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;
|
||||
};
|
||||
Reference in New Issue
Block a user