mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-26 11:57:34 -07:00
refactor: fix type
This commit is contained in:
parent
b87c26127f
commit
ff4b6f51ec
1 changed files with 10 additions and 5 deletions
|
@ -1,12 +1,12 @@
|
||||||
import define from '../../define.js';
|
import { URLSearchParams } from 'node:url';
|
||||||
import { getNote } from '../../common/getters.js';
|
|
||||||
import { ApiError } from '../../error.js';
|
|
||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import config from '@/config/index.js';
|
import config from '@/config/index.js';
|
||||||
import { getAgentByUrl } from '@/misc/fetch.js';
|
import { getAgentByUrl } from '@/misc/fetch.js';
|
||||||
import { URLSearchParams } from 'node:url';
|
|
||||||
import { fetchMeta } from '@/misc/fetch-meta.js';
|
import { fetchMeta } from '@/misc/fetch-meta.js';
|
||||||
import { Notes } from '@/models/index.js';
|
import { Notes } from '@/models/index.js';
|
||||||
|
import { ApiError } from '../../error.js';
|
||||||
|
import { getNote } from '../../common/getters.js';
|
||||||
|
import define from '../../define.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['notes'],
|
tags: ['notes'],
|
||||||
|
@ -80,7 +80,12 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
agent: getAgentByUrl,
|
agent: getAgentByUrl,
|
||||||
});
|
});
|
||||||
|
|
||||||
const json = await res.json();
|
const json = (await res.json()) as {
|
||||||
|
translations: {
|
||||||
|
detected_source_language: string;
|
||||||
|
text: string;
|
||||||
|
}[];
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sourceLang: json.translations[0].detected_source_language,
|
sourceLang: json.translations[0].detected_source_language,
|
||||||
|
|
Loading…
Reference in a new issue