mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-25 14:09:03 -04:00
(ts) migrate <CircleMentions> to composition API with typescript
This commit is contained in:
parent
0e6e2ab2c5
commit
fe808490bd
@ -1,3 +1,19 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
const { $translator: translator } = useNuxtApp();
|
||||||
|
|
||||||
|
const { data: circleMentions } = useFetch<Record<string, Record<string, string>>>(
|
||||||
|
'/api/profile/my-circle-mentions',
|
||||||
|
{ lazy: true },
|
||||||
|
);
|
||||||
|
|
||||||
|
const dialogue = useDialogue();
|
||||||
|
const removeSelf = async (username: string) => {
|
||||||
|
await dialogue.confirm(translator.translate('profile.circles.removeSelf.confirm', { username }), 'warning');
|
||||||
|
await dialogue.postWithAlertOnError(`/api/profile/remove-self-circle/${encodeURIComponent(username)}`);
|
||||||
|
window.location.reload();
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Loading :value="circleMentions">
|
<Loading :value="circleMentions">
|
||||||
<p class="small text-muted">
|
<p class="small text-muted">
|
||||||
@ -41,26 +57,3 @@
|
|||||||
</table>
|
</table>
|
||||||
</Loading>
|
</Loading>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
|
||||||
import { useFetch } from 'nuxt/app';
|
|
||||||
|
|
||||||
import useDialogue from '../composables/useDialogue.ts';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
setup() {
|
|
||||||
const { data: circleMentions } = useFetch('/api/profile/my-circle-mentions', { lazy: true });
|
|
||||||
return {
|
|
||||||
circleMentions,
|
|
||||||
dialogue: useDialogue(),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
async removeSelf(username) {
|
|
||||||
await this.dialogue.confirm(this.$t('profile.circles.removeSelf.confirm', { username }), 'warning');
|
|
||||||
await this.dialogue.postWithAlertOnError(`/api/profile/remove-self-circle/${encodeURIComponent(username)}`);
|
|
||||||
window.location.reload();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user