diff options
| author | おさむのひと <46447427+samunohito@users.noreply.github.com> | 2024-01-04 18:32:46 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-04 18:32:46 +0900 |
| commit | fa9c4a19b98167c7552bec8f4d791bd89db8fbbe (patch) | |
| tree | b889429cd20a5160de818ee61c2dcd9066e2c14b /packages/frontend/src/scripts/get-note-menu.ts | |
| parent | refactor(frontend): reduce type errors (diff) | |
| download | sharkey-fa9c4a19b98167c7552bec8f4d791bd89db8fbbe.tar.gz sharkey-fa9c4a19b98167c7552bec8f4d791bd89db8fbbe.tar.bz2 sharkey-fa9c4a19b98167c7552bec8f4d791bd89db8fbbe.zip | |
refactor(frontend): os.tsに引き込んだscripts/api.tsの再exportをやめる (#12694)
* refactor(frontend): os.tsに引き込んだscripts/api.tsの再exportをやめる
* fix
* fix
* renate to "misskeyApi"
* rename file
Diffstat (limited to 'packages/frontend/src/scripts/get-note-menu.ts')
| -rw-r--r-- | packages/frontend/src/scripts/get-note-menu.ts | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/packages/frontend/src/scripts/get-note-menu.ts b/packages/frontend/src/scripts/get-note-menu.ts index b9224c5595..110be244cb 100644 --- a/packages/frontend/src/scripts/get-note-menu.ts +++ b/packages/frontend/src/scripts/get-note-menu.ts @@ -10,6 +10,7 @@ import { $i } from '@/account.js'; import { i18n } from '@/i18n.js'; import { instance } from '@/instance.js'; import * as os from '@/os.js'; +import { misskeyApi } from '@/scripts/misskey-api.js'; import copyToClipboard from '@/scripts/copy-to-clipboard.js'; import { url } from '@/config.js'; import { defaultStore, noteActions } from '@/store.js'; @@ -40,7 +41,7 @@ export async function getNoteClipMenu(props: { action: () => { claimAchievement('noteClipped1'); os.promiseDialog( - os.api('clips/add-note', { clipId: clip.id, noteId: appearNote.id }), + misskeyApi('clips/add-note', { clipId: clip.id, noteId: appearNote.id }), null, async (err) => { if (err.id === '734806c4-542c-463a-9311-15c512803965') { @@ -145,7 +146,7 @@ export function getNoteMenu(props: { }).then(({ canceled }) => { if (canceled) return; - os.api('notes/delete', { + misskeyApi('notes/delete', { noteId: appearNote.id, }); @@ -162,7 +163,7 @@ export function getNoteMenu(props: { }).then(({ canceled }) => { if (canceled) return; - os.api('notes/delete', { + misskeyApi('notes/delete', { noteId: appearNote.id, }); @@ -243,7 +244,7 @@ export function getNoteMenu(props: { async function translate(): Promise<void> { if (props.translation.value != null) return; props.translating.value = true; - const res = await os.api('notes/translate', { + const res = await misskeyApi('notes/translate', { noteId: appearNote.id, targetLang: miLocalStorage.getItem('lang') ?? navigator.language, }); @@ -253,7 +254,7 @@ export function getNoteMenu(props: { let menu: MenuItem[]; if ($i) { - const statePromise = os.api('notes/state', { + const statePromise = misskeyApi('notes/state', { noteId: appearNote.id, }); @@ -330,7 +331,7 @@ export function getNoteMenu(props: { icon: 'ti ti-user', text: i18n.ts.user, children: async () => { - const user = appearNote.userId === $i?.id ? $i : await os.api('users/show', { userId: appearNote.userId }); + const user = appearNote.userId === $i?.id ? $i : await misskeyApi('users/show', { userId: appearNote.userId }); const { menu, cleanup } = getUserMenu(user); cleanups.push(cleanup); return menu; @@ -361,7 +362,7 @@ export function getNoteMenu(props: { children: async () => { const channelChildMenu = [] as MenuItem[]; - const channel = await os.api('channels/show', { channelId: appearNote.channel!.id }); + const channel = await misskeyApi('channels/show', { channelId: appearNote.channel!.id }); if (channel.pinnedNoteIds.includes(appearNote.id)) { channelChildMenu.push({ @@ -425,7 +426,7 @@ export function getNoteMenu(props: { } if (noteActions.length > 0) { - menu = menu.concat([{ type: "divider" }, ...noteActions.map(action => ({ + menu = menu.concat([{ type: 'divider' }, ...noteActions.map(action => ({ icon: 'ti ti-plug', text: action.title, action: () => { @@ -435,7 +436,7 @@ export function getNoteMenu(props: { } if (defaultStore.state.devMode) { - menu = menu.concat([{ type: "divider" }, { + menu = menu.concat([{ type: 'divider' }, { icon: 'ti ti-id', text: i18n.ts.copyNoteId, action: () => { @@ -499,7 +500,7 @@ export function getRenoteMenu(props: { } if (!props.mock) { - os.api('notes/create', { + misskeyApi('notes/create', { renoteId: appearNote.id, channelId: appearNote.channelId, }).then(() => { @@ -544,7 +545,7 @@ export function getRenoteMenu(props: { } if (!props.mock) { - os.api('notes/create', { + misskeyApi('notes/create', { localOnly, visibility, renoteId: appearNote.id, |