refactor(client): refactor import-export to use Composition API (#8579)
This commit is contained in:
parent
475b7556d8
commit
274ca6f7e6
1 changed files with 63 additions and 91 deletions
|
@ -37,8 +37,8 @@
|
|||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted, ref } from 'vue';
|
||||
<script lang="ts" setup>
|
||||
import { defineExpose, ref } from 'vue';
|
||||
import MkButton from '@/components/ui/button.vue';
|
||||
import FormSection from '@/components/form/section.vue';
|
||||
import FormGroup from '@/components/form/group.vue';
|
||||
|
@ -48,23 +48,6 @@ import { selectFile } from '@/scripts/select-file';
|
|||
import * as symbols from '@/symbols';
|
||||
import { i18n } from '@/i18n';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
FormSection,
|
||||
FormGroup,
|
||||
FormSwitch,
|
||||
MkButton,
|
||||
},
|
||||
|
||||
emits: ['info'],
|
||||
|
||||
setup(props, context) {
|
||||
const INFO = {
|
||||
title: i18n.ts.importAndExport,
|
||||
icon: 'fas fa-boxes',
|
||||
bg: 'var(--bg)',
|
||||
};
|
||||
|
||||
const excludeMutingUsers = ref(false);
|
||||
const excludeInactiveUsers = ref(false);
|
||||
|
||||
|
@ -82,10 +65,10 @@ export default defineComponent({
|
|||
});
|
||||
};
|
||||
|
||||
const onError = (e) => {
|
||||
const onError = (ev) => {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: e.message,
|
||||
text: ev.message,
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -133,23 +116,12 @@ export default defineComponent({
|
|||
os.api('i/import-blocking', { fileId: file.id }).then(onImportSuccess).catch(onError);
|
||||
};
|
||||
|
||||
return {
|
||||
[symbols.PAGE_INFO]: INFO,
|
||||
excludeMutingUsers,
|
||||
excludeInactiveUsers,
|
||||
|
||||
exportNotes,
|
||||
exportFollowing,
|
||||
exportBlocking,
|
||||
exportUserLists,
|
||||
exportMuting,
|
||||
|
||||
importFollowing,
|
||||
importUserLists,
|
||||
importMuting,
|
||||
importBlocking,
|
||||
};
|
||||
},
|
||||
defineExpose({
|
||||
[symbols.PAGE_INFO]: {
|
||||
title: i18n.ts.importAndExport,
|
||||
icon: 'fas fa-boxes',
|
||||
bg: 'var(--bg)',
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in a new issue