mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-23 10:51:02 +00:00
19 lines
639 B
TypeScript
19 lines
639 B
TypeScript
import type { FriendRequest } from "@main/generated/envelope";
|
|
import { HydraApi } from "@main/services/hydra-api";
|
|
import { publishNewFriendRequestNotification } from "@main/services/notifications";
|
|
import { WindowManager } from "@main/services/window-manager";
|
|
|
|
export const friendRequestEvent = async (payload: FriendRequest) => {
|
|
WindowManager.mainWindow?.webContents.send("on-sync-friend-requests", {
|
|
friendRequestCount: payload.friendRequestCount,
|
|
});
|
|
|
|
if (payload.senderId) {
|
|
const user = await HydraApi.get(`/users/${payload.senderId}`);
|
|
|
|
if (user) {
|
|
publishNewFriendRequestNotification(user);
|
|
}
|
|
}
|
|
};
|