apiFetch => cli

This commit is contained in:
tamaina
2021-09-21 03:35:44 +09:00
parent 06207e56cd
commit 5696781a8c
2 changed files with 4 additions and 4 deletions

View File

@@ -10,13 +10,13 @@ import { getAcct } from '@/misc/acct';
import { getAccountFromId } from '@client/scripts/get-account-from-id';
import { appendLoginId } from '@client/scripts/login-id';
export const apiFetch = new Misskey.api.APIClient({ origin });
export const cli = new Misskey.api.APIClient({ origin });
export async function api<E extends keyof Misskey.Endpoints>(endpoint: E, userId: string, options?: Misskey.Endpoints[E]['req']) {
const account = await getAccountFromId(userId);
if (!account) return;
return apiFetch.request(endpoint, options, account.token);
return cli.request(endpoint, options, account.token);
}
// rendered acctからユーザーを開く