diff --git a/frontend/src/lib/data.ts b/frontend/src/lib/data.ts index 5d6e36c7..8c665e1a 100644 --- a/frontend/src/lib/data.ts +++ b/frontend/src/lib/data.ts @@ -1,7 +1,7 @@ import { Category } from "./types"; const sortCategories = (categories: Category[]) => { - const sortedCategories = categories.sort((a, b) => { + return categories.sort((a, b) => { if (a.name === "Proxmox VE Tools") { return -1; } else if (b.name === "Proxmox VE Tools") { @@ -14,13 +14,10 @@ const sortCategories = (categories: Category[]) => { return a.name.localeCompare(b.name); } }); - - return sortedCategories; }; -export const fetchCategories = async () => { - const categories = await fetch(`api/categories`).then((response) => - response.json(), - ); +export const fetchCategories = async (): Promise => { + const response = await fetch("api/categories"); + const categories = await response.json(); return sortCategories(categories); };