mirror of
https://example.com
synced 2024-11-24 11:26:39 +09:00
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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { defineComponent, onMounted, ref } from 'vue';
|
import { defineExpose, ref } from 'vue';
|
||||||
import MkButton from '@/components/ui/button.vue';
|
import MkButton from '@/components/ui/button.vue';
|
||||||
import FormSection from '@/components/form/section.vue';
|
import FormSection from '@/components/form/section.vue';
|
||||||
import FormGroup from '@/components/form/group.vue';
|
import FormGroup from '@/components/form/group.vue';
|
||||||
|
@ -48,23 +48,6 @@ import { selectFile } from '@/scripts/select-file';
|
||||||
import * as symbols from '@/symbols';
|
import * as symbols from '@/symbols';
|
||||||
import { i18n } from '@/i18n';
|
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 excludeMutingUsers = ref(false);
|
||||||
const excludeInactiveUsers = ref(false);
|
const excludeInactiveUsers = ref(false);
|
||||||
|
|
||||||
|
@ -82,10 +65,10 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onError = (e) => {
|
const onError = (ev) => {
|
||||||
os.alert({
|
os.alert({
|
||||||
type: 'error',
|
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);
|
os.api('i/import-blocking', { fileId: file.id }).then(onImportSuccess).catch(onError);
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
defineExpose({
|
||||||
[symbols.PAGE_INFO]: INFO,
|
[symbols.PAGE_INFO]: {
|
||||||
excludeMutingUsers,
|
title: i18n.ts.importAndExport,
|
||||||
excludeInactiveUsers,
|
icon: 'fas fa-boxes',
|
||||||
|
bg: 'var(--bg)',
|
||||||
exportNotes,
|
}
|
||||||
exportFollowing,
|
|
||||||
exportBlocking,
|
|
||||||
exportUserLists,
|
|
||||||
exportMuting,
|
|
||||||
|
|
||||||
importFollowing,
|
|
||||||
importUserLists,
|
|
||||||
importMuting,
|
|
||||||
importBlocking,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue