mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-29 16:07:40 +01:00
Return values instead of promise
Co-authored-by: William Oldham <github@binaryoverload.co.uk>
This commit is contained in:
parent
76d906c95a
commit
0e3f82df30
1 changed files with 3 additions and 3 deletions
|
@ -156,10 +156,10 @@ const headers = {
|
||||||
async function get<T>(url: string, params?: object): Promise<T> {
|
async function get<T>(url: string, params?: object): Promise<T> {
|
||||||
if (!apiKey) throw new Error("TMDB API key not set");
|
if (!apiKey) throw new Error("TMDB API key not set");
|
||||||
|
|
||||||
let res: Promise<T>;
|
let res: T;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
res = await mwFetch<any>(encodeURI(url), {
|
res = await mwFetch<T>(encodeURI(url), {
|
||||||
headers,
|
headers,
|
||||||
baseURL,
|
baseURL,
|
||||||
params: {
|
params: {
|
||||||
|
@ -170,7 +170,7 @@ async function get<T>(url: string, params?: object): Promise<T> {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (baseURL !== otherUrl) {
|
if (baseURL !== otherUrl) {
|
||||||
baseURL = otherUrl;
|
baseURL = otherUrl;
|
||||||
res = await mwFetch<any>(encodeURI(url), {
|
res = await mwFetch<T>(encodeURI(url), {
|
||||||
headers,
|
headers,
|
||||||
baseURL,
|
baseURL,
|
||||||
params: {
|
params: {
|
||||||
|
|
Loading…
Reference in a new issue