mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-20 14:37:43 +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> {
|
||||
if (!apiKey) throw new Error("TMDB API key not set");
|
||||
|
||||
let res: Promise<T>;
|
||||
let res: T;
|
||||
|
||||
try {
|
||||
res = await mwFetch<any>(encodeURI(url), {
|
||||
res = await mwFetch<T>(encodeURI(url), {
|
||||
headers,
|
||||
baseURL,
|
||||
params: {
|
||||
|
@ -170,7 +170,7 @@ async function get<T>(url: string, params?: object): Promise<T> {
|
|||
} catch (err) {
|
||||
if (baseURL !== otherUrl) {
|
||||
baseURL = otherUrl;
|
||||
res = await mwFetch<any>(encodeURI(url), {
|
||||
res = await mwFetch<T>(encodeURI(url), {
|
||||
headers,
|
||||
baseURL,
|
||||
params: {
|
||||
|
|
Loading…
Reference in a new issue