mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-04 06:50:15 +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",
|
output: "export",
|
||||||
basePath: "/ProxmoxVE",
|
basePath: "/ProxmoxVE",
|
||||||
};
|
};
|
||||||
|
@ -47,7 +47,9 @@ function ScriptContent() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetch("api/categories")
|
fetch(
|
||||||
|
`/api/categories?_=${process.env.NEXT_PUBLIC_BUILD_TIME || Date.now()}`,
|
||||||
|
)
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((categories) => {
|
.then((categories) => {
|
||||||
const sortedCategories = sortCategories(categories);
|
const sortedCategories = sortCategories(categories);
|
||||||
|
@ -52,7 +52,9 @@ export default function CommandMenu() {
|
|||||||
|
|
||||||
const fetchCategories = async () => {
|
const fetchCategories = async () => {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
fetch("api/categories")
|
fetch(
|
||||||
|
`/api/categories?_=${process.env.NEXT_PUBLIC_BUILD_TIME || Date.now()}`,
|
||||||
|
)
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((categories) => {
|
.then((categories) => {
|
||||||
const sortedCategories = sortCategories(categories);
|
const sortedCategories = sortCategories(categories);
|
||||||
@ -61,7 +63,7 @@ export default function CommandMenu() {
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
console.error(error)
|
console.error(error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user