mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-13 07:55:06 +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
@ -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 New Issue
Block a user