mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: temp remove fetch from local cache
This commit is contained in:
parent
c8022896a6
commit
be08fb6d14
4 changed files with 45 additions and 17 deletions
|
|
@ -3,6 +3,7 @@ import {
|
|||
userPreferencesRepository,
|
||||
} from "@main/repository";
|
||||
import { HydraApi } from "../hydra-api";
|
||||
import { AchievementData } from "@types";
|
||||
|
||||
export const getGameAchievementData = async (
|
||||
objectId: string,
|
||||
|
|
@ -12,13 +13,13 @@ export const getGameAchievementData = async (
|
|||
where: { id: 1 },
|
||||
});
|
||||
|
||||
return HydraApi.get("/games/achievements", {
|
||||
return HydraApi.get<AchievementData[]>("/games/achievements", {
|
||||
shop,
|
||||
objectId,
|
||||
language: userPreferences?.language || "en",
|
||||
})
|
||||
.then(async (achievements) => {
|
||||
await gameAchievementRepository.upsert(
|
||||
.then((achievements) => {
|
||||
gameAchievementRepository.upsert(
|
||||
{
|
||||
objectId,
|
||||
shop,
|
||||
|
|
@ -29,5 +30,13 @@ export const getGameAchievementData = async (
|
|||
|
||||
return achievements;
|
||||
})
|
||||
.catch(() => []);
|
||||
.catch(() => {
|
||||
return gameAchievementRepository
|
||||
.findOne({
|
||||
where: { objectId, shop },
|
||||
})
|
||||
.then((gameAchievements) => {
|
||||
return JSON.parse(gameAchievements?.achievements || "[]");
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue