fix: Incorrect tmdb account details

This commit is contained in:
Aleksi Lassila
2024-06-09 15:20:54 +03:00
parent 48f3831f36
commit 7d8c32317f
2 changed files with 35 additions and 10 deletions

View File

@@ -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:

View File

@@ -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();
}
@@ -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;
}
@@ -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: {
@@ -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: {
@@ -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)
);
};
}