refactor(client): refactor admin/other-settings to use Composition API (#8667)

This commit is contained in:
Andreas Nedbal 2022-05-25 09:38:18 +02:00 committed by GitHub
parent 67f3515dc1
commit 81fccb5656
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,52 +6,35 @@
</MkSpacer> </MkSpacer>
</template> </template>
<script lang="ts"> <script lang="ts" setup>
import { defineComponent } from 'vue'; import { } from 'vue';
import FormSwitch from '@/components/form/switch.vue';
import FormInput from '@/components/form/input.vue';
import FormSection from '@/components/form/section.vue';
import FormSuspense from '@/components/form/suspense.vue'; import FormSuspense from '@/components/form/suspense.vue';
import * as os from '@/os'; import * as os from '@/os';
import * as symbols from '@/symbols'; import * as symbols from '@/symbols';
import { fetchInstance } from '@/instance'; import { fetchInstance } from '@/instance';
import { i18n } from '@/i18n';
export default defineComponent({ async function init() {
components: { await os.api('admin/meta');
FormSwitch, }
FormInput,
FormSection,
FormSuspense,
},
emits: ['info'], function save() {
os.apiWithDialog('admin/update-meta').then(() => {
fetchInstance();
});
}
data() { defineExpose({
return {
[symbols.PAGE_INFO]: { [symbols.PAGE_INFO]: {
title: this.$ts.other, title: i18n.ts.other,
icon: 'fas fa-cogs', icon: 'fas fa-cogs',
bg: 'var(--bg)', bg: 'var(--bg)',
actions: [{ actions: [{
asFullButton: true, asFullButton: true,
icon: 'fas fa-check', icon: 'fas fa-check',
text: this.$ts.save, text: i18n.ts.save,
handler: this.save, handler: save,
}], }],
},
}
},
methods: {
async init() {
const meta = await os.api('admin/meta');
},
save() {
os.apiWithDialog('admin/update-meta', {
}).then(() => {
fetchInstance();
});
}
} }
}); });
</script> </script>