Skip to content

Commit

Permalink
fix: Incorrect tmdb account details
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksilassila committed Jun 9, 2024
1 parent 48f3831 commit 7d8c323
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 10 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ Contributions are welcome! See [contributing](#Contributing) for more informatio

![Demo Video](images/reiverr-demo.gif)

## Reiverr 1.0

This is the page for Reiverr 2.0, which is a rewrite of the project with TVs in mind.
It still lacks many features of the previous version. If you want a more stable experience,
or only care about the web app, you might want to check out the
[1.0 branch](https://github.com/aleksilassila/reiverr/tree/reiverr-1.0) for now.

# List of major features

TMDB Discovery:
Expand Down
38 changes: 28 additions & 10 deletions src/lib/apis/tmdb/tmdb-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@ export class TmdbApi implements Api<paths> {
});
}

static getClient4l() {
const sessionId = get(appState)?.user?.settings.tmdb.sessionId;

return createClient<paths4>({
baseUrl: 'https://api.themoviedb.org',
headers: {
Authorization: `Bearer ${sessionId}`
}
});
}

getClient() {
return TmdbApi.getClient();
}
Expand All @@ -80,6 +91,10 @@ export class TmdbApi implements Api<paths> {
return TmdbApi.getClient4();
}

getClient4l() {
return TmdbApi.getClient4l();
}

getSessionId() {
return get(appState)?.user?.settings.tmdb.sessionId;
}
Expand Down Expand Up @@ -316,7 +331,7 @@ export class TmdbApi implements Api<paths> {

const top100: TmdbMovieSmall[] = await Promise.all(
[...Array(5).keys()].map((i) =>
this.getClient4()
this.getClient4l()
?.GET('/4/account/{account_object_id}/movie/recommendations', {
params: {
path: {
Expand Down Expand Up @@ -391,7 +406,7 @@ export class TmdbApi implements Api<paths> {

const top100: TmdbSeriesSmall[] = await Promise.all(
[...Array(5).keys()].map((i) =>
this.getClient4()
this.getClient4l()
?.GET('/4/account/{account_object_id}/tv/recommendations', {
params: {
path: {
Expand Down Expand Up @@ -463,15 +478,18 @@ export class TmdbApi implements Api<paths> {
const userId = this.getUserId();
if (!userId) return undefined;

return this.getClient()
?.GET('/3/account/{account_id}', {
params: {
path: {
account_id: Number(userId)
return (
this.getClient4l()
// @ts-ignore
?.GET('/4/account/{account_object_id}', {
params: {
path: {
account_object_id: userId
}
}
}
})
.then((res) => res.data);
})
.then((res) => res.data)
);
};
}

Expand Down

0 comments on commit 7d8c323

Please sign in to comment.