refactor: `popup()`の`props`に`ref`な値を入れるのを許可するように
This commit is contained in:
parent
931199ae6a
commit
d688de597e
|
@ -185,7 +185,7 @@ export async function refreshAccount() {
|
|||
export async function login(token: Account['token'], redirect?: string) {
|
||||
const showing = ref(true);
|
||||
popup(defineAsyncComponent(() => import('@/components/MkWaitingDialog.vue')), {
|
||||
success: ref(false),
|
||||
success: false,
|
||||
showing: showing,
|
||||
}, {}, 'closed');
|
||||
if (_DEV_) console.log('logging as token ', token);
|
||||
|
|
|
@ -14,14 +14,14 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { Ref, watch, shallowRef } from 'vue';
|
||||
import { watch, shallowRef } from 'vue';
|
||||
import MkModal from '@/components/MkModal.vue';
|
||||
|
||||
const modal = shallowRef<InstanceType<typeof MkModal>>();
|
||||
|
||||
const props = defineProps<{
|
||||
success: Ref<boolean>;
|
||||
showing: Ref<boolean>;
|
||||
success: boolean;
|
||||
showing: boolean;
|
||||
text?: string;
|
||||
}>();
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { Component, markRaw, Ref, ref, defineAsyncComponent } from 'vue';
|
||||
import { EventEmitter } from 'eventemitter3';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import type { ComponentProps } from 'vue-component-type-helpers';
|
||||
import type { ComponentProps as CP } from 'vue-component-type-helpers';
|
||||
import type { Form, GetFormResultType } from '@/scripts/form.js';
|
||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
|
@ -159,6 +159,9 @@ type ComponentEmit<T> = T extends new () => { $props: infer Props }
|
|||
: never
|
||||
: never;
|
||||
|
||||
// props に ref を許可するようにする
|
||||
type ComponentProps<T extends Component> = { [K in keyof CP<T>]: CP<T>[K] | Ref<CP<T>[K]> };
|
||||
|
||||
type EmitsExtractor<T> = {
|
||||
[K in keyof T as K extends `onVnode${string}` ? never : K extends `on${infer E}` ? Uncapitalize<E> : K extends string ? never : K]: T[K];
|
||||
};
|
||||
|
@ -416,7 +419,7 @@ export function success(): Promise<void> {
|
|||
showing.value = false;
|
||||
}, 1000);
|
||||
popup(MkWaitingDialog, {
|
||||
success: ref(true),
|
||||
success: true,
|
||||
showing: showing,
|
||||
}, {
|
||||
done: () => resolve(),
|
||||
|
@ -428,7 +431,7 @@ export function waiting(): Promise<void> {
|
|||
return new Promise(resolve => {
|
||||
const showing = ref(true);
|
||||
popup(MkWaitingDialog, {
|
||||
success: ref(false),
|
||||
success: false,
|
||||
showing: showing,
|
||||
}, {
|
||||
done: () => resolve(),
|
||||
|
|
Loading…
Reference in New Issue