refactor: fix type
This commit is contained in:
parent
3770bb6576
commit
1ee757cc5f
|
@ -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 New Issue