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 = {
1414 ] ,
1515 } ,
1616
17+ env : {
18+ NEXT_PUBLIC_BUILD_TIME : `${ Date . now ( ) } ` ,
19+ } ,
20+
1721 output : "export" ,
1822 // basePath: "/proxmox-helper-scripts",
1923} ;
Original file line number Diff line number Diff line change @@ -47,7 +47,9 @@ function ScriptContent() {
4747 } ;
4848
4949 useEffect ( ( ) => {
50- fetch ( "api/categories" )
50+ fetch (
51+ `api/categories?_=${ process . env . NEXT_PUBLIC_BUILD_TIME || Date . now ( ) } ` ,
52+ )
5153 . then ( ( response ) => response . json ( ) )
5254 . then ( ( categories ) => {
5355 const sortedCategories = sortCategories ( categories ) ;
Original file line number Diff line number Diff line change @@ -50,24 +50,13 @@ export default function CommandMenu() {
5050 } , [ ] ) ;
5151
5252 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 ) => {
6356 const sortedCategories = sortCategories ( categories ) ;
6457 setLinks ( sortedCategories ) ;
65- } catch ( error ) {
66- console . error ( error ) ;
67- }
68- } ;
69-
70- fetchCategories ( ) ;
58+ } )
59+ . catch ( ( error ) => console . error ( error ) ) ;
7160 } , [ ] ) ;
7261
7362 return (
You can’t perform that action at this time.
0 commit comments