diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2023-09-20 16:44:12 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2023-09-20 16:44:12 +0900 |
| commit | 8e2d47b2e882a9fb10e60c2ea0274a0fa54abb8f (patch) | |
| tree | 0394121add0eab089abb02baafcb6fdcf96bfaac /packages/frontend/src/scripts/api.ts | |
| parent | update deps (#11849) (diff) | |
| download | sharkey-8e2d47b2e882a9fb10e60c2ea0274a0fa54abb8f.tar.gz sharkey-8e2d47b2e882a9fb10e60c2ea0274a0fa54abb8f.tar.bz2 sharkey-8e2d47b2e882a9fb10e60c2ea0274a0fa54abb8f.zip | |
refactor
Diffstat (limited to 'packages/frontend/src/scripts/api.ts')
| -rw-r--r-- | packages/frontend/src/scripts/api.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/packages/frontend/src/scripts/api.ts b/packages/frontend/src/scripts/api.ts index d73d60cf26..9259c88013 100644 --- a/packages/frontend/src/scripts/api.ts +++ b/packages/frontend/src/scripts/api.ts @@ -3,21 +3,21 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import { Endpoints } from 'misskey-js/built/api.types'; +import * as Misskey from 'misskey-js'; import { ref } from 'vue'; import { apiUrl } from '@/config.js'; import { $i } from '@/account.js'; 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, signal?: AbortSignal): Promise<Endpoints[E]['res']> { +export function api<E extends keyof Misskey.Endpoints, P extends Misskey.Endpoints[E]['req']>(endpoint: E, data: P = {} as any, token?: string | null | undefined, signal?: AbortSignal): Promise<Misskey.Endpoints[E]['res']> { pendingApiRequestsCount.value++; const onFinally = () => { pendingApiRequestsCount.value--; }; - const promise = new Promise<Endpoints[E]['res'] | void>((resolve, reject) => { + const promise = new Promise<Misskey.Endpoints[E]['res'] | void>((resolve, reject) => { // Append a credential if ($i) (data as any).i = $i.token; if (token !== undefined) (data as any).i = token; @@ -51,7 +51,7 @@ export function api<E extends keyof Endpoints, P extends Endpoints[E]['req']>(en } // Implements Misskey.api.ApiClient.request -export function apiGet <E extends keyof Endpoints, P extends Endpoints[E]['req']>(endpoint: E, data: P = {} as any): Promise<Endpoints[E]['res']> { +export function apiGet <E extends keyof Misskey.Endpoints, P extends Misskey.Endpoints[E]['req']>(endpoint: E, data: P = {} as any): Promise<Misskey.Endpoints[E]['res']> { pendingApiRequestsCount.value++; const onFinally = () => { @@ -60,7 +60,7 @@ export function apiGet <E extends keyof Endpoints, P extends Endpoints[E]['req'] const query = new URLSearchParams(data as any); - const promise = new Promise<Endpoints[E]['res'] | void>((resolve, reject) => { + const promise = new Promise<Misskey.Endpoints[E]['res'] | void>((resolve, reject) => { // Send request window.fetch(`${apiUrl}/${endpoint}?${query}`, { method: 'GET', |