fix bug in seat plan editor (loading broken)

This commit is contained in:
2023-09-01 09:50:40 +02:00
parent e26369f133
commit bac321f48e
3 changed files with 33 additions and 5 deletions

View File

@@ -113,11 +113,23 @@ class POSTHandler {
reject( { 'code': 500, 'error': error } ); reject( { 'code': 500, 'error': error } );
} ); } );
} else if ( call === 'createAdminAccount' ) { } else if ( call === 'createAdminAccount' ) {
db.writeDataSimple( 'admin', 'email', data.email ) db.writeDataSimple( 'admin', 'email', data.email, data ).then( resp => {
resolve( resp );
} ).catch( error => {
reject( { 'code': 500, 'error': error } );
} );
} else if ( call === 'updateAdminAccount' ) { } else if ( call === 'updateAdminAccount' ) {
// TODO: Finish db.writeDataSimple( 'admin', 'email', data.email, data ).then( resp => {
resolve( resp );
} ).catch( error => {
reject( { 'code': 500, 'error': error } );
} );
} else if ( call === 'deleteAdminAccount' ) { } else if ( call === 'deleteAdminAccount' ) {
// TODO: Finish db.deleteDataSimple( 'admin', 'email', data.email ).then( resp => {
resolve( resp );
} ).catch( error => {
reject( { 'code': 500, 'error': error } );
} );
} else if ( call === 'updateSettings' ) { } else if ( call === 'updateSettings' ) {
this.settings[ 'twoFA' ] = data.twoFA; this.settings[ 'twoFA' ] = data.twoFA;
this.settings[ 'currency' ] = data.currency; this.settings[ 'currency' ] = data.currency;

View File

@@ -132,7 +132,17 @@
}; };
// Auto save every 60s (60K ms) // Auto save every 60s (60K ms)
this.autoSave = setInterval( this.saveDraft(), 60000 ); this.autoSave = setInterval( () => {
const options = {
method: 'post',
body: JSON.stringify( { 'data':{ 'seatInfo': this.seatCountInfo, 'data': this.scaleDown( this.draggables ) }, 'location': sessionStorage.getItem( 'locationID' ) } ),
headers: {
'Content-Type': 'application/json',
'charset': 'utf-8'
}
};
fetch( localStorage.getItem( 'url' ) + '/admin/api/saveSeatplanDraft', options );
}, 60000 );
/* /*
Calculate scale factor (this adds support for differently sized screens) Calculate scale factor (this adds support for differently sized screens)

View File

@@ -9,7 +9,7 @@
<template> <template>
<div> <div>
<h2>Seat Plan Editor</h2> <h2>Seat Plan Editor ({{ location }})</h2>
<window /> <window />
</div> </div>
</template> </template>
@@ -18,6 +18,11 @@
import window from '@/components/seatplan/editor/window.vue'; import window from '@/components/seatplan/editor/window.vue';
export default { export default {
data () {
return {
location: '',
};
},
components: { components: {
window, window,
}, },
@@ -26,6 +31,7 @@
if ( !sessionStorage.getItem( 'locationID' ) ) { if ( !sessionStorage.getItem( 'locationID' ) ) {
this.$router.push( '/admin/locations' ); this.$router.push( '/admin/locations' );
} }
this.location = sessionStorage.getItem( 'locationID' );
} }
}, },
created() { created() {