mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-15 16:33:02 -03:00
feat: handle empty response on update achievements
This commit is contained in:
@@ -2,6 +2,7 @@ import type {
|
||||
Game,
|
||||
GameShop,
|
||||
UnlockedAchievement,
|
||||
UpdatedUnlockedAchievements,
|
||||
UserPreferences,
|
||||
} from "@types";
|
||||
import { WindowManager } from "../window-manager";
|
||||
@@ -115,7 +116,7 @@ export const mergeAchievements = async (
|
||||
}
|
||||
|
||||
if (game.remoteId) {
|
||||
await HydraApi.put(
|
||||
await HydraApi.put<UpdatedUnlockedAchievements | undefined>(
|
||||
"/profile/games/achievements",
|
||||
{
|
||||
id: game.remoteId,
|
||||
@@ -124,10 +125,19 @@ export const mergeAchievements = async (
|
||||
{ needsSubscription: !newAchievements.length }
|
||||
)
|
||||
.then((response) => {
|
||||
if (response) {
|
||||
return saveAchievementsOnLocal(
|
||||
response.objectId,
|
||||
response.shop,
|
||||
response.achievements,
|
||||
publishNotification
|
||||
);
|
||||
}
|
||||
|
||||
return saveAchievementsOnLocal(
|
||||
response.objectId,
|
||||
response.shop,
|
||||
response.achievements,
|
||||
game.objectId,
|
||||
game.shop,
|
||||
mergedLocalAchievements,
|
||||
publishNotification
|
||||
);
|
||||
})
|
||||
|
||||
@@ -25,7 +25,7 @@ import "./sidebar.scss";
|
||||
const achievementsPlaceholder: UserAchievement[] = [
|
||||
{
|
||||
displayName: "Timber!!",
|
||||
name: "",
|
||||
name: "1",
|
||||
hidden: false,
|
||||
description: "Chop down your first tree.",
|
||||
icon: "https://cdn.akamai.steamstatic.com/steamcommunity/public/images/apps/105600/0fbb33098c9da39d1d4771d8209afface9c46e81.jpg",
|
||||
@@ -36,7 +36,7 @@ const achievementsPlaceholder: UserAchievement[] = [
|
||||
},
|
||||
{
|
||||
displayName: "Supreme Helper Minion!",
|
||||
name: "",
|
||||
name: "2",
|
||||
hidden: false,
|
||||
icon: "https://cdn.akamai.steamstatic.com/steamcommunity/public/images/apps/105600/0a6ff6a36670c96ceb4d30cf6fd69d2fdf55f38e.jpg",
|
||||
icongray:
|
||||
@@ -46,7 +46,7 @@ const achievementsPlaceholder: UserAchievement[] = [
|
||||
},
|
||||
{
|
||||
displayName: "Feast of Midas",
|
||||
name: "",
|
||||
name: "3",
|
||||
hidden: false,
|
||||
icon: "https://cdn.akamai.steamstatic.com/steamcommunity/public/images/apps/105600/2d10311274fe7c92ab25cc29afdca86b019ad472.jpg",
|
||||
icongray:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Cracker, DownloadSourceStatus, Downloader } from "@shared";
|
||||
import type { SteamAppDetails } from "./steam.types";
|
||||
import type { Download, Game, Subscription } from "./level.types";
|
||||
import type { GameShop } from "./game.types";
|
||||
import type { GameShop, UnlockedAchievement } from "./game.types";
|
||||
|
||||
export type FriendRequestAction = "ACCEPTED" | "REFUSED" | "CANCEL";
|
||||
|
||||
@@ -237,6 +237,12 @@ export interface UserStats {
|
||||
unlockedAchievementSum?: number;
|
||||
}
|
||||
|
||||
export interface UpdatedUnlockedAchievements {
|
||||
objectId: string;
|
||||
shop: GameShop;
|
||||
achievements: UnlockedAchievement[];
|
||||
}
|
||||
|
||||
export interface AchievementFile {
|
||||
type: Cracker;
|
||||
filePath: string;
|
||||
|
||||
Reference in New Issue
Block a user