feat: auth using sse
This commit is contained in:
1 parent
b72355f7b8
commit
df0f7c943b
10 files changed
+1101
-292
No files matched your search
+6
-2
@@ -1,7 +1,11 @@
|
||||
class Http {
|
||||
private base = 'https://api.themoviedb.org/3';
|
||||
|
||||
get<T>(url: string, { params }: { params?: Record<string, unknown> } = {}, base?: string): Promise<T> {
|
||||
get<T>(
|
||||
url: string,
|
||||
{ params, force }: { params?: Record<string, unknown>; force?: boolean } = {},
|
||||
base?: string
|
||||
): Promise<T> {
|
||||
const serializedParams = Object.entries(params || {}).reduce((params, [key, value]) => {
|
||||
if (!['', undefined, null].includes(value as string)) {
|
||||
params.set(key, value as string);
|
||||
@@ -14,7 +18,7 @@ class Http {
|
||||
headers: {
|
||||
Authorization: `Bearer ${process.env.MOVIE_DB_TOKEN}`
|
||||
},
|
||||
next: { revalidate: 3600 }
|
||||
next: force ? undefined : { revalidate: 3600 }
|
||||
}).then((response) => {
|
||||
if (!response.ok) return Promise.reject(response);
|
||||
|
||||
|
||||
Reference in new issue
Block a user