File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,6 +80,26 @@ async function loadLayout() {
8080 dashboardGrid . load ( savedLayout ) ;
8181 console . log ( "Layout sauber neu geladen." ) ;
8282 }
83+
84+
85+ }
86+
87+ async function resetDatabaseLayout ( ) {
88+ if ( ! confirm ( "Möchtest du das Layout wirklich auf Standard zurücksetzen?" ) ) return ;
89+
90+ const storedPw = sessionStorage . getItem ( 'admin_pw' ) ;
91+ if ( ! storedPw ) return alert ( "Bitte erst einloggen!" ) ;
92+
93+ // Wir senden ein leeres Array oder null, damit der Server es löscht/leert
94+ await fetch ( '/api/layout' , {
95+ method : 'POST' ,
96+ headers : { 'Content-Type' : 'application/json' } ,
97+ body : JSON . stringify ( {
98+ layout : [ ] , // Leeres Layout erzwingen
99+ pw : storedPw
100+ } )
101+ } ) ;
102+ location . reload ( ) ;
83103}
84104
85105document . addEventListener ( "DOMContentLoaded" , async ( ) => {
Original file line number Diff line number Diff line change 8181 < button class ="btn-primary " onclick ="savePrice() " style ="padding: 8px 15px; "> +</ button >
8282 </ div >
8383 </ div >
84+ < button class ="btn-secondary " id ="unlockBtn " onclick ="resetDatabaseLayout() "> Layout zurücksetzen </ button >
8485 </ div >
8586 </ div >
8687
You can’t perform that action at this time.
0 commit comments