refactor(frontend): os.tsに引き込んだscripts/api.tsの再exportをやめる (#12694)

* refactor(frontend): os.tsに引き込んだscripts/api.tsの再exportをやめる

* fix

* fix

* renate to "misskeyApi"

* rename file
This commit is contained in:
おさむのひと
2024-01-04 18:32:46 +09:00
committed by GitHub
parent ea41cc6ec0
commit fa9c4a19b9
191 changed files with 581 additions and 468 deletions

View File

@@ -19,6 +19,7 @@ import XColumn from './column.vue';
import { updateColumn, Column } from './deck-store.js';
import MkTimeline from '@/components/MkTimeline.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
const props = defineProps<{
@@ -35,7 +36,7 @@ onMounted(() => {
});
async function setAntenna() {
const antennas = await os.api('antennas/list');
const antennas = await misskeyApi('antennas/list');
const { canceled, result: antenna } = await os.select({
title: i18n.ts.selectAntenna,
items: antennas.map(x => ({

View File

@@ -26,6 +26,7 @@ import { updateColumn, Column } from './deck-store.js';
import MkTimeline from '@/components/MkTimeline.vue';
import MkButton from '@/components/MkButton.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
const props = defineProps<{
@@ -41,7 +42,7 @@ if (props.column.channelId == null) {
}
async function setChannel() {
const channels = await os.api('channels/my-favorites', {
const channels = await misskeyApi('channels/my-favorites', {
limit: 100,
});
const { canceled, result: channel } = await os.select({
@@ -60,7 +61,7 @@ async function setChannel() {
async function post() {
if (!channel.value || channel.value.id !== props.column.channelId) {
channel.value = await os.api('channels/show', {
channel.value = await misskeyApi('channels/show', {
channelId: props.column.channelId,
});
}

View File

@@ -7,7 +7,7 @@ import { throttle } from 'throttle-debounce';
import { markRaw } from 'vue';
import { notificationTypes } from 'misskey-js';
import { Storage } from '@/pizzax.js';
import { api } from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { deepClone } from '@/scripts/clone.js';
type ColumnWidget = {
@@ -70,7 +70,7 @@ export const loadDeck = async () => {
let deck;
try {
deck = await api('i/registry/get', {
deck = await misskeyApi('i/registry/get', {
scope: ['client', 'deck', 'profiles'],
key: deckStore.state.profile,
});
@@ -95,7 +95,7 @@ export const loadDeck = async () => {
// TODO: deckがloadされていない状態でsaveすると意図せず上書きが発生するので対策する
export const saveDeck = throttle(1000, () => {
api('i/registry/set', {
misskeyApi('i/registry/set', {
scope: ['client', 'deck', 'profiles'],
key: deckStore.state.profile,
value: {
@@ -106,13 +106,13 @@ export const saveDeck = throttle(1000, () => {
});
export async function getProfiles(): Promise<string[]> {
return await api('i/registry/keys', {
return await misskeyApi('i/registry/keys', {
scope: ['client', 'deck', 'profiles'],
});
}
export async function deleteProfile(key: string): Promise<void> {
return await api('i/registry/remove', {
return await misskeyApi('i/registry/remove', {
scope: ['client', 'deck', 'profiles'],
key: key,
});

View File

@@ -19,6 +19,7 @@ import XColumn from './column.vue';
import { updateColumn, Column } from './deck-store.js';
import MkTimeline from '@/components/MkTimeline.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
const props = defineProps<{
@@ -40,7 +41,7 @@ watch(withRenotes, v => {
});
async function setList() {
const lists = await os.api('users/lists/list');
const lists = await misskeyApi('users/lists/list');
const { canceled, result: list } = await os.select({
title: i18n.ts.selectList,
items: lists.map(x => ({

View File

@@ -19,6 +19,7 @@ import XColumn from './column.vue';
import { updateColumn, Column } from './deck-store.js';
import MkTimeline from '@/components/MkTimeline.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
const props = defineProps<{
@@ -35,7 +36,7 @@ onMounted(() => {
});
async function setRole() {
const roles = (await os.api('roles/list')).filter(x => x.isExplorable);
const roles = (await misskeyApi('roles/list')).filter(x => x.isExplorable);
const { canceled, result: role } = await os.select({
title: i18n.ts.role,
items: roles.map(x => ({