mirror of
https://github.com/BreizhHardware/Jellystat.git
synced 2026-01-18 16:27:20 +01:00
better error handling in api
This commit is contained in:
@@ -109,7 +109,7 @@ class EmbyAPI {
|
||||
return response?.data || [];
|
||||
}
|
||||
|
||||
console.log(response?.data || response);
|
||||
console.log("[JELLYFIN-API] : getUsers - " + (response?.data || response));
|
||||
|
||||
return [];
|
||||
} catch (error) {
|
||||
@@ -355,12 +355,20 @@ class EmbyAPI {
|
||||
if (!userid || userid == null) {
|
||||
let adminid = await new configClass().getPreferedAdmin();
|
||||
if (!adminid || adminid == null) {
|
||||
userid = (await this.getAdmins())[0].Id;
|
||||
const admins = await this.getAdmins();
|
||||
if (admins.length > 0) {
|
||||
userid = admins[0].Id;
|
||||
}
|
||||
} else {
|
||||
userid = adminid;
|
||||
}
|
||||
}
|
||||
|
||||
if (!userid || userid == null) {
|
||||
console.log("[JELLYFIN-API]: getRecentlyAdded - No Admins/UserIds found");
|
||||
return [];
|
||||
}
|
||||
|
||||
let url = `${this.config.JF_HOST}/Users/${userid}/Items/Latest?Limit=${limit}`;
|
||||
|
||||
if (libraryid && libraryid != null) {
|
||||
|
||||
@@ -108,7 +108,7 @@ class JellyfinAPI {
|
||||
return response?.data || [];
|
||||
}
|
||||
|
||||
console.log(response?.data || response);
|
||||
console.log("[JELLYFIN-API] : getUsers - " + (response?.data || response));
|
||||
|
||||
return [];
|
||||
} catch (error) {
|
||||
@@ -352,12 +352,20 @@ class JellyfinAPI {
|
||||
if (!userid || userid == null) {
|
||||
let adminid = await new configClass().getPreferedAdmin();
|
||||
if (!adminid || adminid == null) {
|
||||
userid = (await this.getAdmins())[0].Id;
|
||||
const admins = await this.getAdmins();
|
||||
if (admins.length > 0) {
|
||||
userid = admins[0].Id;
|
||||
}
|
||||
} else {
|
||||
userid = adminid;
|
||||
}
|
||||
}
|
||||
|
||||
if (!userid || userid == null) {
|
||||
console.log("[JELLYFIN-API]: getRecentlyAdded - No Admins/UserIds found");
|
||||
return [];
|
||||
}
|
||||
|
||||
let url = `${this.config.JF_HOST}/Users/${userid}/Items/Latest?Limit=${limit}`;
|
||||
|
||||
if (libraryid && libraryid != null) {
|
||||
|
||||
Reference in New Issue
Block a user