File tree Expand file tree Collapse file tree 3 files changed +12
-17
lines changed Expand file tree Collapse file tree 3 files changed +12
-17
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ const nextConfig = {
14
14
] ,
15
15
} ,
16
16
17
+ env : {
18
+ NEXT_PUBLIC_BUILD_TIME : `${ Date . now ( ) } ` ,
19
+ } ,
20
+
17
21
output : "export" ,
18
22
// basePath: "/proxmox-helper-scripts",
19
23
} ;
Original file line number Diff line number Diff line change @@ -47,7 +47,9 @@ function ScriptContent() {
47
47
} ;
48
48
49
49
useEffect ( ( ) => {
50
- fetch ( "api/categories" )
50
+ fetch (
51
+ `api/categories?_=${ process . env . NEXT_PUBLIC_BUILD_TIME || Date . now ( ) } ` ,
52
+ )
51
53
. then ( ( response ) => response . json ( ) )
52
54
. then ( ( categories ) => {
53
55
const sortedCategories = sortCategories ( categories ) ;
Original file line number Diff line number Diff line change @@ -50,24 +50,13 @@ export default function CommandMenu() {
50
50
} , [ ] ) ;
51
51
52
52
React . useEffect ( ( ) => {
53
- const fetchCategories = async ( ) : Promise < void > => {
54
- try {
55
- const response = await fetch ( "api/categories" ) ;
56
- if ( ! response . ok ) {
57
- throw new Error ( "Failed to fetch categories" ) ;
58
- }
59
- const categories : Category [ ] = await response . json ( ) ;
60
- if ( categories . length === 0 ) {
61
- throw new Error ( "Empty response" ) ;
62
- }
53
+ fetch ( `api/categories?_=${ process . env . NEXT_PUBLIC_BUILD_TIME || Date . now ( ) } ` )
54
+ . then ( ( response ) => response . json ( ) )
55
+ . then ( ( categories ) => {
63
56
const sortedCategories = sortCategories ( categories ) ;
64
57
setLinks ( sortedCategories ) ;
65
- } catch ( error ) {
66
- console . error ( error ) ;
67
- }
68
- } ;
69
-
70
- fetchCategories ( ) ;
58
+ } )
59
+ . catch ( ( error ) => console . error ( error ) ) ;
71
60
} , [ ] ) ;
72
61
73
62
return (
You can’t perform that action at this time.
0 commit comments