mirror of
https://git.boykissers.com/pawkey/pawkey-sk.git
synced 2025-12-20 04:04:16 +00:00
allow os.promiseDialog to accept a callback
This commit is contained in:
@@ -101,7 +101,7 @@ export const apiWithDialog = (<
|
||||
});
|
||||
|
||||
export function promiseDialog<T extends Promise<any>>(
|
||||
promise: T,
|
||||
promise: T | (() => T),
|
||||
onSuccess?: ((res: Awaited<T>) => void) | null,
|
||||
onFailure?: ((err: Misskey.api.APIError) => void) | null,
|
||||
text?: string,
|
||||
@@ -109,6 +109,10 @@ export function promiseDialog<T extends Promise<any>>(
|
||||
const showing = ref(true);
|
||||
const success = ref(false);
|
||||
|
||||
if (typeof(promise) === 'function') {
|
||||
promise = promise();
|
||||
}
|
||||
|
||||
promise.then(res => {
|
||||
if (onSuccess) {
|
||||
showing.value = false;
|
||||
|
||||
Reference in New Issue
Block a user