mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-20 14:37:43 +01:00
If TMDB key is empty, don't attempt request
This commit is contained in:
parent
95a75f81b1
commit
e555354e17
1 changed files with 5 additions and 1 deletions
|
@ -144,12 +144,16 @@ export function decodeTMDBId(
|
||||||
|
|
||||||
const baseURL = "https://api.themoviedb.org/3";
|
const baseURL = "https://api.themoviedb.org/3";
|
||||||
|
|
||||||
|
const apiKey = conf().TMDB_READ_API_KEY;
|
||||||
|
|
||||||
const headers = {
|
const headers = {
|
||||||
accept: "application/json",
|
accept: "application/json",
|
||||||
Authorization: `Bearer ${conf().TMDB_READ_API_KEY}`,
|
Authorization: `Bearer ${apiKey}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
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");
|
||||||
|
|
||||||
const res = await mwFetch<any>(encodeURI(url), {
|
const res = await mwFetch<any>(encodeURI(url), {
|
||||||
headers,
|
headers,
|
||||||
baseURL,
|
baseURL,
|
||||||
|
|
Loading…
Reference in a new issue