start pages settings (BROKEN)

This commit is contained in:
janis
2023-09-04 17:05:58 +02:00
parent bebf53e5eb
commit a52ec14845
5 changed files with 48 additions and 4 deletions

View File

@@ -10,7 +10,10 @@
<template>
<div>
<h2>Pages</h2>
<p>Here you can modify your landing page (the start page of libreǝvent) and other pages</p>
<p>Here you can modify your landing page (the start page of libreǝvent)</p>
<select name="templateSel" id="templateSel" v-bind="selectedTemplate">
<option v-for="el in startPageTemplates" :value="el">{{ el }}</option>
</select>
</div>
</template>
@@ -18,13 +21,44 @@
export default {
data () {
return {
formData: {}
startPageTemplates: [],
startPageSettings: {},
selectedTemplate: '',
}
},
methods: {
setup () {
loadPageSettings() {
fetch( '/admin/getAPI/getStartPageSettings?name=' + this.selectedTemplate ).then( res => {
if ( res.status === 200 ) {
res.json().then( json => {
this.startPageSettings = json;
} );
}
} );
}
},
watch: {
selectedTemplate( value ) {
this.loadPageSettings();
}
},
created () {
fetch( '/admin/getAPI/getAllStartPages' ).then( res => {
if ( res.status === 200 ) {
res.json().then( json => {
this.startPageTemplates = json;
} );
}
} );
fetch( '/admin/getAPI/getSettings' ).then( res => {
if ( res.status === 200 ) {
res.json().then( json => {
console.log( json[ 'startPage' ] );
this.selectedTemplate = json[ 'startPage' ];
} );
}
} );
}
};
</script>