mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: get friends requests from api
This commit is contained in:
parent
6ff48605da
commit
b3f87d5662
8 changed files with 54 additions and 32 deletions
|
|
@ -43,6 +43,7 @@ import "./auth/sign-out";
|
|||
import "./auth/open-auth-window";
|
||||
import "./auth/get-session-hash";
|
||||
import "./user/get-user";
|
||||
import "./profile/get-friend-requests";
|
||||
import "./profile/get-me";
|
||||
import "./profile/update-profile";
|
||||
|
||||
|
|
|
|||
16
src/main/events/profile/get-friend-requests.ts
Normal file
16
src/main/events/profile/get-friend-requests.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { registerEvent } from "../register-event";
|
||||
import { HydraApi } from "@main/services";
|
||||
import { PendingFriendRequest } from "@types";
|
||||
|
||||
const getFriendRequests = async (
|
||||
_event: Electron.IpcMainInvokeEvent
|
||||
): Promise<PendingFriendRequest[] | null> => {
|
||||
try {
|
||||
const response = await HydraApi.get(`/profile/friend-requests`);
|
||||
return response.data;
|
||||
} catch (err) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
registerEvent("getFriendRequests", getFriendRequests);
|
||||
Loading…
Add table
Add a link
Reference in a new issue