use ViewBase queries to fetch all data

This commit is contained in:
axolotle 2021-04-17 00:08:47 +02:00
parent 1efb23e26d
commit bb2358e779

View file

@ -1,8 +1,8 @@
<template> <template>
<view-base :loading="loading"> <view-base :queries="queries" @queries-response="onQueriesResponse">
<template v-if="infos"> <template v-if="infos">
<!-- BASIC INFOS --> <!-- BASIC INFOS -->
<card :title="`${name}`" icon="download"> <card :title="name" icon="download">
<b-row <b-row
v-for="(info, key) in infos" :key="key" v-for="(info, key) in infos" :key="key"
no-gutters class="row-line" no-gutters class="row-line"
@ -63,7 +63,12 @@ export default {
data () { data () {
return { return {
loading: true, queries: [
['GET', 'apps/manifest?app=' + this.id],
['GET', { uri: 'domains' }],
['GET', { uri: 'domains/main', storeKey: 'main_domain' }],
['GET', { uri: 'users' }]
],
name: undefined, name: undefined,
infos: undefined, infos: undefined,
formDisclaimer: null, formDisclaimer: null,
@ -79,8 +84,7 @@ export default {
}, },
methods: { methods: {
onQueriesResponse (manifest) {
formatManifestData (manifest) {
this.name = manifest.name this.name = manifest.name
const infosKeys = ['id', 'description', 'license', 'version', 'multi_instance'] const infosKeys = ['id', 'description', 'license', 'version', 'multi_instance']
if (manifest.license === undefined || manifest.license === 'free') { if (manifest.license === undefined || manifest.license === 'free') {
@ -99,7 +103,6 @@ export default {
this.fields = fields this.fields = fields
this.form = form this.form = form
this.validations = { form: validations } this.validations = { form: validations }
this.loading = false
}, },
async performInstall () { async performInstall () {
@ -120,17 +123,6 @@ export default {
this.serverError = err.message this.serverError = err.message
}) })
} }
},
created () {
Promise.all([
api.get('apps/manifest?app=' + this.id).then(response => response),
api.fetchAll([
['GET', { uri: 'domains' }],
['GET', { uri: 'domains/main', storeKey: 'main_domain' }],
['GET', { uri: 'users' }]
])
]).then((responses) => this.formatManifestData(responses[0]))
} }
} }
</script> </script>