mirror of
https://github.com/aleksilassila/reiverr.git
synced 2026-04-18 07:53:15 +02:00
fix: Incorrect tmdb account details
This commit is contained in:
@@ -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)
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user