From 5696781a8c40e678ba8457cfbd1ea105c611216a Mon Sep 17 00:00:00 2001 From: tamaina Date: Tue, 21 Sep 2021 03:35:44 +0900 Subject: [PATCH] apiFetch => cli --- src/client/sw/create-notification.ts | 4 ++-- src/client/sw/operations.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/client/sw/create-notification.ts b/src/client/sw/create-notification.ts index d6927f9bbd..390e8c298f 100644 --- a/src/client/sw/create-notification.ts +++ b/src/client/sw/create-notification.ts @@ -8,7 +8,7 @@ import getUserName from '@/misc/get-user-name'; import { swLang } from '@client/sw/lang'; import { I18n } from '@/misc/i18n'; import { pushNotificationDataMap } from '@client/sw/types'; -import { apiFetch } from './operations'; +import { cli } from './operations'; import { getAccountFromId } from '@client/scripts/get-account-from-id'; export async function createNotification(data: pushNotificationDataMap[K]) { @@ -41,7 +41,7 @@ async function composeNotification(data // users/showの型定義をswos.apiへ当てはめるのが困難なのでapiFetch.requestを直接使用 const account = await getAccountFromId(data.userId); if (!account) return null; - const userDetail = apiFetch.request('users/show', { userId: data.body.userId }, account.token); + const userDetail = cli.request('users/show', { userId: data.body.userId }, account.token); return [t('_notification.youWereFollowed'), { body: getUserName(data.body.user), icon: data.body.user.avatarUrl, diff --git a/src/client/sw/operations.ts b/src/client/sw/operations.ts index 369f24beb2..0bae06d519 100644 --- a/src/client/sw/operations.ts +++ b/src/client/sw/operations.ts @@ -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(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からユーザーを開く