mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-23 04:33:50 +01:00
refactor(client): refactor admin/instance-block to use Composition API (#8663)
This commit is contained in:
parent
2317105922
commit
24aaad4b26
@ -2,57 +2,45 @@
|
|||||||
<MkSpacer :content-max="700" :margin-min="16" :margin-max="32">
|
<MkSpacer :content-max="700" :margin-min="16" :margin-max="32">
|
||||||
<FormSuspense :p="init">
|
<FormSuspense :p="init">
|
||||||
<FormTextarea v-model="blockedHosts" class="_formBlock">
|
<FormTextarea v-model="blockedHosts" class="_formBlock">
|
||||||
<span>{{ $ts.blockedInstances }}</span>
|
<span>{{ i18n.ts.blockedInstances }}</span>
|
||||||
<template #caption>{{ $ts.blockedInstancesDescription }}</template>
|
<template #caption>{{ i18n.ts.blockedInstancesDescription }}</template>
|
||||||
</FormTextarea>
|
</FormTextarea>
|
||||||
|
|
||||||
<FormButton primary class="_formBlock" @click="save"><i class="fas fa-save"></i> {{ $ts.save }}</FormButton>
|
<FormButton primary class="_formBlock" @click="save"><i class="fas fa-save"></i> {{ i18n.ts.save }}</FormButton>
|
||||||
</FormSuspense>
|
</FormSuspense>
|
||||||
</MkSpacer>
|
</MkSpacer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { defineComponent } from 'vue';
|
import { } from 'vue';
|
||||||
import FormButton from '@/components/ui/button.vue';
|
import FormButton from '@/components/ui/button.vue';
|
||||||
import FormTextarea from '@/components/form/textarea.vue';
|
import FormTextarea from '@/components/form/textarea.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({
|
let blockedHosts: string = $ref('');
|
||||||
components: {
|
|
||||||
FormButton,
|
|
||||||
FormTextarea,
|
|
||||||
FormSuspense,
|
|
||||||
},
|
|
||||||
|
|
||||||
emits: ['info'],
|
async function init() {
|
||||||
|
const meta = await os.api('admin/meta');
|
||||||
|
blockedHosts = meta.blockedHosts.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
data() {
|
function save() {
|
||||||
return {
|
os.apiWithDialog('admin/update-meta', {
|
||||||
[symbols.PAGE_INFO]: {
|
blockedHosts: blockedHosts.split('\n') || [],
|
||||||
title: this.$ts.instanceBlocking,
|
}).then(() => {
|
||||||
icon: 'fas fa-ban',
|
fetchInstance();
|
||||||
bg: 'var(--bg)',
|
});
|
||||||
},
|
}
|
||||||
blockedHosts: '',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
defineExpose({
|
||||||
async init() {
|
[symbols.PAGE_INFO]: {
|
||||||
const meta = await os.api('admin/meta');
|
title: i18n.ts.instanceBlocking,
|
||||||
this.blockedHosts = meta.blockedHosts.join('\n');
|
icon: 'fas fa-ban',
|
||||||
},
|
bg: 'var(--bg)',
|
||||||
|
|
||||||
save() {
|
|
||||||
os.apiWithDialog('admin/update-meta', {
|
|
||||||
blockedHosts: this.blockedHosts.split('\n') || [],
|
|
||||||
}).then(() => {
|
|
||||||
fetchInstance();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user