import { request } from '../utils/request';

export const contentApi = {
    list: (params) => {
        const qs = new URLSearchParams(params).toString();
        return request(`/contents?${qs}`);
    },
    get: (id) => request(`/contents/${id}`),
    listComments: (id, page) => request(`/contents/${id}/comments?page=${page || 1}`),
    createComment: (id, data) => request(`/contents/${id}/comments`, { method: 'POST', body: data }),
    likeComment: (id) => request(`/comments/${id}/like`, { method: 'POST' }),
    listTopics: () => request('/topics'),
};
