apiFetch => cli
This commit is contained in:
parent
06207e56cd
commit
5696781a8c
|
@ -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<K extends keyof pushNotificationDataMap>(data: pushNotificationDataMap[K]) {
|
||||
|
@ -41,7 +41,7 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(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,
|
||||
|
|
|
@ -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からユーザーを開く
|
||||
|
|
Loading…
Reference in New Issue