123456789101112131415161718192021222324252627282930 |
- import { favorComment, unFavorComment } from '@/services/comment';
-
- export const toggleFavor = async ({
- favored,
- id,
- commentId,
- userId,
- }: {
- id: string;
- favored: boolean;
- commentId: string;
- userId: number;
- }) => {
- let responseData;
- if (!favored) {
- responseData = await favorComment({
- id,
- commentId,
- userId,
- })
- } else {
- responseData = await unFavorComment({
- id,
- commentId,
- userId,
- })
- }
-
- return responseData.data;
- }
|