Files

75 lines
1.4 KiB
TypeScript
Raw Permalink Normal View History

2026-04-25 16:36:34 +08:00
import { request } from '../api/request';
export interface FriendRequest {
_id: string;
from: string;
to: string;
message: string;
}
/**
*
* @param targetId id
*/
export async function addFriendRequest(
targetId: string
): Promise<FriendRequest> {
const { data } = await request.post('/api/friend/request/add', {
to: targetId,
});
return data;
}
/**
*
* @param requestId ID
*/
export async function acceptFriendRequest(requestId: string): Promise<void> {
await request.post('/api/friend/request/accept', {
requestId,
});
}
/**
*
* @param requestId ID
*/
export async function denyFriendRequest(requestId: string): Promise<void> {
await request.post('/api/friend/request/deny', {
requestId,
});
}
/**
*
* @param requestId ID
*/
export async function cancelFriendRequest(requestId: string): Promise<void> {
await request.post('/api/friend/request/cancel', {
requestId,
});
}
/**
* ()
*/
export async function removeFriend(friendUserId: string): Promise<void> {
await request.post('/api/friend/removeFriend', {
friendUserId,
});
}
/**
*
*/
export async function setFriendNickname(
targetId: string,
nickname: string
): Promise<void> {
await request.post('/api/friend/setFriendNickname', {
targetId,
nickname,
});
}