Fix gamemode checks

This commit is contained in:
seditionist
2023-11-26 18:55:26 -05:00
parent bdfdf1eb14
commit 561495632c

View File

@@ -287,17 +287,13 @@ export async function getStats(
const main = await getOfficialStats(rsn, 'main', options?.axiosConfigs?.main); const main = await getOfficialStats(rsn, 'main', options?.axiosConfigs?.main);
const emptyResponse: HiscoresResponse = {
skills: [],
activities: []
};
const getModeStats = async ( const getModeStats = async (
mode: Extract<Gamemode, 'ironman' | 'hardcore' | 'ultimate'> mode: Extract<Gamemode, 'ironman' | 'hardcore' | 'ultimate'>
): Promise<HiscoresResponse | undefined> => ): Promise<HiscoresResponse | undefined> =>
otherGamemodes.includes(mode) otherGamemodes.includes(mode)
? getOfficialStats(rsn, mode, options?.axiosConfigs?.[mode]) ? getOfficialStats(rsn, mode, options?.axiosConfigs?.[mode])
.catch(err => err) .catch(() => undefined)
: emptyResponse; : undefined;
const formattedName = shouldGetFormattedRsn const formattedName = shouldGetFormattedRsn
? await getRSNFormat(rsn, options?.axiosConfigs?.rsn).catch( ? await getRSNFormat(rsn, options?.axiosConfigs?.rsn).catch(
() => undefined () => undefined