mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
19 lines
529 B
TypeScript
19 lines
529 B
TypeScript
import { registerEvent } from "../register-event";
|
|
import { HydraApi } from "@main/services";
|
|
import { FriendRequestAction } from "@types";
|
|
|
|
const updateFriendRequest = async (
|
|
_event: Electron.IpcMainInvokeEvent,
|
|
userId: string,
|
|
action: FriendRequestAction
|
|
) => {
|
|
if (action == "CANCEL") {
|
|
return HydraApi.delete(`/profile/friend-requests/${userId}`);
|
|
}
|
|
|
|
return HydraApi.patch(`/profile/friend-requests/${userId}`, {
|
|
requestState: action,
|
|
});
|
|
};
|
|
|
|
registerEvent("updateFriendRequest", updateFriendRequest);
|