You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailchat/client/shared/model/friend.ts

62 lines
1.2 KiB
TypeScript

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,
});
}