api: get rid of getJSON

let's just call `match` directly
This commit is contained in:
dumbmoron
2024-05-15 12:45:23 +00:00
parent c1958596e9
commit c5c3682462
3 changed files with 20 additions and 22 deletions

View File

@@ -1,18 +0,0 @@
import { apiJSON } from "./sub/utils.js";
import { errorUnsupported } from "./sub/errors.js";
import loc from "../localization/manager.js";
import match from "./processing/match.js";
import { extract } from "./processing/url.js";
export async function getJSON(url, lang, obj) {
try {
const parsed = extract(url);
if (parsed === null) {
return apiJSON(0, { t: errorUnsupported(lang) });
}
return await match(parsed.host, parsed.patternMatch, url, lang, obj)
} catch (e) {
return apiJSON(0, { t: loc(lang, 'ErrorSomethingWentWrong') })
}
}