mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-11 13:56:16 +00:00
Fix: updated pinnedDate logic, set default values for pagination, deleted comments, deleted example in user-profile-context
This commit is contained in:
@@ -13,13 +13,13 @@ const addGameToPinned = async (
|
||||
const game = await gamesSublevel.get(gameKey);
|
||||
if (!game) return;
|
||||
|
||||
HydraApi.put(`/profile/games/${shop}/${objectId}/pin`).catch(() => {});
|
||||
const response = await HydraApi.put(`/profile/games/${shop}/${objectId}/pin`);
|
||||
|
||||
try {
|
||||
await gamesSublevel.put(gameKey, {
|
||||
...game,
|
||||
pinned: true,
|
||||
pinnedDate: new Date(),
|
||||
pinnedDate: new Date(response.pinnedDate),
|
||||
});
|
||||
} catch (error) {
|
||||
throw new Error(`Failed to update game pinned status: ${error}`);
|
||||
|
||||
@@ -5,18 +5,13 @@ import type { UserLibraryResponse } from "@types";
|
||||
const getUserLibrary = async (
|
||||
_event: Electron.IpcMainInvokeEvent,
|
||||
userId: string,
|
||||
take?: number,
|
||||
skip?: number
|
||||
take: number = 12,
|
||||
skip: number = 0
|
||||
): Promise<UserLibraryResponse | null> => {
|
||||
const params = new URLSearchParams();
|
||||
|
||||
if (take !== undefined) {
|
||||
params.append("take", take.toString());
|
||||
}
|
||||
|
||||
if (skip !== undefined) {
|
||||
params.append("skip", skip.toString());
|
||||
}
|
||||
params.append("take", take.toString());
|
||||
params.append("skip", skip.toString());
|
||||
|
||||
const queryString = params.toString();
|
||||
const baseUrl = `/users/${userId}/library`;
|
||||
|
||||
@@ -93,8 +93,7 @@ export function UserProfileContextProvider({
|
||||
|
||||
const getUserLibraryGames = useCallback(async () => {
|
||||
try {
|
||||
// Example usage with pagination: take=24, skip=0
|
||||
const response = await window.electron.getUserLibrary(userId, 24, 0);
|
||||
const response = await window.electron.getUserLibrary(userId);
|
||||
if (response) {
|
||||
setLibraryGames(response.library);
|
||||
setPinnedGames(response.pinnedGames);
|
||||
|
||||
Reference in New Issue
Block a user