mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-01-10 19:05:09 +00:00
Add NEXT_PUBLIC_BUILD_TIME to config and append timestamp to API requests for fresh category data retrieval
This commit is contained in:
parent
4ca45042cc
commit
63aa8e2aa8
@ -14,6 +14,10 @@ const nextConfig = {
|
||||
],
|
||||
},
|
||||
|
||||
env: {
|
||||
NEXT_PUBLIC_BUILD_TIME: Date.now(),
|
||||
},
|
||||
|
||||
output: "export",
|
||||
basePath: "/ProxmoxVE",
|
||||
};
|
||||
|
@ -47,13 +47,15 @@ function ScriptContent() {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
fetch("api/categories")
|
||||
.then((response) => response.json())
|
||||
.then((categories) => {
|
||||
const sortedCategories = sortCategories(categories);
|
||||
setLinks(sortedCategories);
|
||||
})
|
||||
.catch((error) => console.error(error));
|
||||
fetch(
|
||||
`/api/categories?_=${process.env.NEXT_PUBLIC_BUILD_TIME || Date.now()}`,
|
||||
)
|
||||
.then((response) => response.json())
|
||||
.then((categories) => {
|
||||
const sortedCategories = sortCategories(categories);
|
||||
setLinks(sortedCategories);
|
||||
})
|
||||
.catch((error) => console.error(error));
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
@ -52,17 +52,19 @@ export default function CommandMenu() {
|
||||
|
||||
const fetchCategories = async () => {
|
||||
setIsLoading(true);
|
||||
fetch("api/categories")
|
||||
.then((response) => response.json())
|
||||
.then((categories) => {
|
||||
const sortedCategories = sortCategories(categories);
|
||||
setLinks(sortedCategories);
|
||||
setIsLoading(false);
|
||||
})
|
||||
.catch((error) => {
|
||||
setIsLoading(false);
|
||||
console.error(error)
|
||||
});
|
||||
fetch(
|
||||
`/api/categories?_=${process.env.NEXT_PUBLIC_BUILD_TIME || Date.now()}`,
|
||||
)
|
||||
.then((response) => response.json())
|
||||
.then((categories) => {
|
||||
const sortedCategories = sortCategories(categories);
|
||||
setLinks(sortedCategories);
|
||||
setIsLoading(false);
|
||||
})
|
||||
.catch((error) => {
|
||||
setIsLoading(false);
|
||||
console.error(error);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user