fix: 登録フォームにおける競合状態を修正 (#10267)

* fix: 登録フォームにおける競合状態を修正

* エラーを修正
This commit is contained in:
RyotaK
2023-03-08 16:32:13 +09:00
committed by GitHub
parent dd6569a1bb
commit 116dd097bd
3 changed files with 26 additions and 7 deletions

View File

@@ -5,7 +5,7 @@ import { $i } from '@/account';
export const pendingApiRequestsCount = ref(0);
// Implements Misskey.api.ApiClient.request
export function api<E extends keyof Endpoints, P extends Endpoints[E]['req']>(endpoint: E, data: P = {} as any, token?: string | null | undefined): Promise<Endpoints[E]['res']> {
export function api<E extends keyof Endpoints, P extends Endpoints[E]['req']>(endpoint: E, data: P = {} as any, token?: string | null | undefined, signal?: AbortSignal): Promise<Endpoints[E]['res']> {
pendingApiRequestsCount.value++;
const onFinally = () => {
@@ -26,6 +26,7 @@ export function api<E extends keyof Endpoints, P extends Endpoints[E]['req']>(en
headers: {
'Content-Type': 'application/json',
},
signal,
}).then(async (res) => {
const body = res.status === 204 ? null : await res.json();