feat:profile endpoint change and complete pinning functionality

This commit is contained in:
Moyasee
2025-09-24 14:04:55 +03:00
parent 33c15baf0e
commit 092af7e421
12 changed files with 96 additions and 23 deletions

View File

@@ -0,0 +1,27 @@
import { registerEvent } from "../register-event";
import { HydraApi } from "@main/services";
import type { UserLibraryResponse } from "@types";
const getUserLibrary = async (
_event: Electron.IpcMainInvokeEvent,
userId: string,
take?: number,
skip?: number
): Promise<UserLibraryResponse | null> => {
const params = new URLSearchParams();
if (take !== undefined) {
params.append('take', take.toString());
}
if (skip !== undefined) {
params.append('skip', skip.toString());
}
const queryString = params.toString();
const url = `/users/${userId}/library${queryString ? `?${queryString}` : ''}`;
return HydraApi.get<UserLibraryResponse>(url).catch(() => null);
};
registerEvent("getUserLibrary", getUserLibrary);