emit waiting status from MkFollowButton
This commit is contained in:
@@ -35,7 +35,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
import { onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { host } from '@@/js/config.js';
|
||||
import * as os from '@/os.js';
|
||||
@@ -59,7 +59,8 @@ const props = withDefaults(defineProps<{
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
(_: 'update:user', value: Misskey.entities.UserDetailed): void
|
||||
(_: 'update:user', value: Misskey.entities.UserDetailed): void,
|
||||
(_: 'update:wait', value: boolean): void,
|
||||
}>();
|
||||
|
||||
const isFollowing = ref(props.user.isFollowing);
|
||||
@@ -67,6 +68,9 @@ const hasPendingFollowRequestFromYou = ref(props.user.hasPendingFollowRequestFro
|
||||
const wait = ref(false);
|
||||
const connection = useStream().useChannel('main');
|
||||
|
||||
// Emit the "wait" status so external components can synchronize state
|
||||
watch(wait, value => emit('update:wait', value));
|
||||
|
||||
if (props.user.isFollowing == null && $i) {
|
||||
misskeyApi('users/show', {
|
||||
userId: props.user.id,
|
||||
|
||||
Reference in New Issue
Block a user