Files
yourpart3/frontend/src/api/friendshipApi.js
2024-12-04 19:08:26 +01:00

23 lines
746 B
JavaScript

import apiClient from "@/utils/axios.js";
export const getFriendships = async (acceptedOnly) => {
const response = await apiClient.get(`/api/friendships?acceptedOnly=${acceptedOnly}`);
return response.data;
};
export const endFriendship = async (friendUserId) => {
await apiClient.post("/api/friendships/end", { friendUserId });
};
export const acceptFriendship = async (friendUserId) => {
await apiClient.post("/api/friendships/accept", { friendUserId });
};
export const rejectFriendship = async (friendUserId) => {
await apiClient.post("/api/friendships/reject", { friendUserId });
};
export const withdrawRequest = async (friendUserId) => {
await apiClient.post("/api/friendships/withdraw", { friendUserId });
};