Skip to content

Commit 5c93ca0

Browse files
fix(getSkyBlockProfiles): fetching garden & museum while either are disabled (#684)
* fix: museum and garden options * pnpm lint * only fetch when options explicitly set to true Co-authored-by: Jacob <kathund@proton.me> * simplify ternary * also respect options in fetchSkyblockProfile * fix(getSkyBlockProfile/s): garden & museum types --------- Co-authored-by: Jacob <kathund@proton.me>
1 parent 4717323 commit 5c93ca0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/API/getSkyBlockProfile.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ class getSkyBlockProfile extends Endpoint {
1212
const res = await this.client.requestHandler.request(`/skyblock/profile?profile=${profileId}`, options);
1313
if (res.options.raw) return res;
1414
if (!res.data.profile) throw new Error(Errors.NO_SKYBLOCK_PROFILES);
15-
const garden = await this.handleGettingSkyBlockGarden(res.data.profile.profile_id);
16-
const museum = await this.handleGettingSkyBlockMuseum(res.data.profile.profile_id);
15+
const garden = options?.museum ? await this.handleGettingSkyBlockGarden(res.data.profile.profile_id) : undefined;
16+
const museum = options?.museum ? await this.handleGettingSkyBlockMuseum(res.data.profile.profile_id) : undefined;
1717
const parsedProfile = new SkyBlockProfile(res.data.profile, { uuid: null, garden, museum });
1818
return parsedProfile;
1919
}

src/API/getSkyBlockProfiles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class getSkyBlockProfiles extends Endpoint {
1919
if (!res.data.profiles || !res.data.profiles.length) throw new Error(Errors.NO_SKYBLOCK_PROFILES);
2020
const profiles: Map<SkyBlockProfileName | 'UNKNOWN', SkyBlockProfile> = new Map();
2121
for (const profile of res.data.profiles) {
22-
const garden = await this.handleGettingSkyBlockGarden(profile.profile_id);
23-
const museum = await this.handleGettingSkyBlockMuseum(profile.profile_id);
22+
const garden = options?.garden ? await this.handleGettingSkyBlockGarden(profile.profile_id) : undefined;
23+
const museum = options?.museum ? await this.handleGettingSkyBlockMuseum(profile.profile_id) : undefined;
2424
const parsedProfile = new SkyBlockProfile(profile, { uuid: query, garden, museum });
2525
profiles.set(parsedProfile.profileName, parsedProfile);
2626
}

0 commit comments

Comments
 (0)