diff options
| author | Andreas Nedbal <github-bf215181b5140522137b3d4f6b73544a@desu.email> | 2022-05-25 09:38:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-25 16:38:18 +0900 |
| commit | 81fccb56565dfa90a619b94ff8a69a460cdabc24 (patch) | |
| tree | 0bf8985bf5a68057025d33b81efc635b368242a3 | |
| parent | Refactor admin/overview to use Composition API (#8674) (diff) | |
| download | sharkey-81fccb56565dfa90a619b94ff8a69a460cdabc24.tar.gz sharkey-81fccb56565dfa90a619b94ff8a69a460cdabc24.tar.bz2 sharkey-81fccb56565dfa90a619b94ff8a69a460cdabc24.zip | |
refactor(client): refactor admin/other-settings to use Composition API (#8667)
| -rw-r--r-- | packages/client/src/pages/admin/other-settings.vue | 61 |
1 files changed, 22 insertions, 39 deletions
diff --git a/packages/client/src/pages/admin/other-settings.vue b/packages/client/src/pages/admin/other-settings.vue index 99ea6a5f32..552b05f347 100644 --- a/packages/client/src/pages/admin/other-settings.vue +++ b/packages/client/src/pages/admin/other-settings.vue @@ -6,52 +6,35 @@ </MkSpacer> </template> -<script lang="ts"> -import { defineComponent } from 'vue'; -import FormSwitch from '@/components/form/switch.vue'; -import FormInput from '@/components/form/input.vue'; -import FormSection from '@/components/form/section.vue'; +<script lang="ts" setup> +import { } from 'vue'; import FormSuspense from '@/components/form/suspense.vue'; import * as os from '@/os'; import * as symbols from '@/symbols'; import { fetchInstance } from '@/instance'; +import { i18n } from '@/i18n'; -export default defineComponent({ - components: { - FormSwitch, - FormInput, - FormSection, - FormSuspense, - }, +async function init() { + await os.api('admin/meta'); +} - emits: ['info'], +function save() { + os.apiWithDialog('admin/update-meta').then(() => { + fetchInstance(); + }); +} - data() { - return { - [symbols.PAGE_INFO]: { - title: this.$ts.other, - icon: 'fas fa-cogs', - bg: 'var(--bg)', - actions: [{ - asFullButton: true, - icon: 'fas fa-check', - text: this.$ts.save, - handler: this.save, - }], - }, - } - }, - - methods: { - async init() { - const meta = await os.api('admin/meta'); - }, - save() { - os.apiWithDialog('admin/update-meta', { - }).then(() => { - fetchInstance(); - }); - } +defineExpose({ + [symbols.PAGE_INFO]: { + title: i18n.ts.other, + icon: 'fas fa-cogs', + bg: 'var(--bg)', + actions: [{ + asFullButton: true, + icon: 'fas fa-check', + text: i18n.ts.save, + handler: save, + }], } }); </script> |