add changes, credits, search

This commit is contained in:
Blake Joynes
2021-05-15 11:05:40 -04:00
parent adaad60d4c
commit 4cc6ea50df
22 changed files with 4938 additions and 202 deletions

View File

@@ -1,22 +1,20 @@
import fetch from 'node-fetch';
const BASE_URL_V3 = 'https://api.themoviedb.org/3';
const BASE_URL_V3 = 'https://api.themoviedb.org/3'
export default class Api {
constructor(private accessToken: string) {
this.accessToken = accessToken;
}
export class Api{
constructor(private accessToken: string){
this.accessToken = accessToken
}
async get<T>(path: string): Promise<T> {
const response = await fetch(`${BASE_URL_V3}${path}`, {
method: 'GET',
headers: {
Authorization: `Bearer ${this.accessToken}`,
'Content-Type': 'application/json;charset=utf-8'
},
});
return await response.json() as T;
}
async get<T>(path: string): Promise<T> {
const response = await fetch(`${BASE_URL_V3}${path}`, {
method: 'GET',
headers: {
Authorization: `Bearer ${this.accessToken}`,
'Content-Type': 'application/json;charset=utf-8',
},
});
return await response.json() as T;
}
}