mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 21:44:55 +03:00
feat: route adjustment
This commit is contained in:
parent
eda47fc6af
commit
333b143b17
@ -6,6 +6,7 @@ import {
|
||||
gameRepository,
|
||||
userPreferencesRepository,
|
||||
} from "@main/repository";
|
||||
import { UserNotLoggedInError } from "@shared";
|
||||
|
||||
const getGameAchievements = async (
|
||||
_event: Electron.IpcMainInvokeEvent,
|
||||
@ -22,11 +23,11 @@ const getGameAchievements = async (
|
||||
}),
|
||||
]);
|
||||
|
||||
const apiAchievement = HydraApi.get(
|
||||
"/games/achievements",
|
||||
{ objectId, shop, language: userPreferences?.language || "en" },
|
||||
{ needsAuth: false }
|
||||
)
|
||||
const apiAchievement = HydraApi.get("/games/achievements", {
|
||||
objectId,
|
||||
shop,
|
||||
language: userPreferences?.language || "en",
|
||||
})
|
||||
.then((achievements) => {
|
||||
if (game) {
|
||||
gameAchievementRepository.upsert(
|
||||
@ -41,7 +42,10 @@ const getGameAchievements = async (
|
||||
|
||||
return achievements;
|
||||
})
|
||||
.catch(() => []);
|
||||
.catch((err) => {
|
||||
if (err instanceof UserNotLoggedInError) throw err;
|
||||
return [];
|
||||
});
|
||||
|
||||
const gameAchievements = cachedAchievements?.achievements
|
||||
? JSON.parse(cachedAchievements.achievements)
|
||||
|
@ -145,7 +145,9 @@ export function GameDetailsContextProvider({
|
||||
.then((achievements) => {
|
||||
setAchievements(achievements);
|
||||
})
|
||||
.catch(() => {});
|
||||
.catch(() => {
|
||||
// TODO: handle user not logged in error
|
||||
});
|
||||
|
||||
updateGame();
|
||||
}, [updateGame, dispatch, gameTitle, objectID, shop, i18n.language]);
|
||||
@ -183,7 +185,8 @@ export function GameDetailsContextProvider({
|
||||
|
||||
window.electron
|
||||
.getGameAchievements(objectID!, shop as GameShop)
|
||||
.then(setAchievements);
|
||||
.then(setAchievements)
|
||||
.catch(() => {});
|
||||
}
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user