mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-01-30 12:30:15 +00:00
Update page.tsx
This commit is contained in:
parent
ad2ea710a4
commit
9d46bd8f78
@ -10,19 +10,20 @@ const CategoryView = () => {
|
|||||||
const [selectedCategory, setSelectedCategory] = useState<Category | null>(null);
|
const [selectedCategory, setSelectedCategory] = useState<Category | null>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchCategories = async () => {
|
const fetchCategories = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch("/api/categories");
|
const basePath = process.env.NODE_ENV === "production" ? "/ProxmoxVE" : ""; // Passe den Basis-Pfad an
|
||||||
if (!response.ok) {
|
const response = await fetch(`${basePath}/api/categories`);
|
||||||
throw new Error("Failed to fetch categories");
|
if (!response.ok) {
|
||||||
}
|
throw new Error("Failed to fetch categories");
|
||||||
const data = await response.json();
|
}
|
||||||
console.log("Fetched categories:", data); // Debugging
|
const data = await response.json();
|
||||||
setCategories(data);
|
console.log("Fetched categories:", data); // Debugging
|
||||||
} catch (error) {
|
setCategories(data);
|
||||||
console.error("Error fetching categories:", error);
|
} catch (error) {
|
||||||
}
|
console.error("Error fetching categories:", error);
|
||||||
};
|
}
|
||||||
|
};
|
||||||
|
|
||||||
fetchCategories();
|
fetchCategories();
|
||||||
}, []);
|
}, []);
|
||||||
|
Loading…
Reference in New Issue
Block a user