| import { api } from './auth'; // 复用已有的axios实例
|
| export const createTorrent = (torrentName, description, username, category, region, resolution, subtitle, filePath) => {
|
| return api.post('/torrent', {
|
| export const getTorrents = (page = 1, size = 5) => {
|
| return api.get('/torrent', {
|
| export const getTorrentDetail = (torrentId) => {
|
| return api.get(`/torrent/${torrentId}`).then(response => {
|
| if (response.data && response.data.data) {
|
| torrent: response.data.data.post || response.data.data.torrent,
|
| comments: response.data.data.comments || []
|
| export const likeTorrent = (torrentId) => {
|
| return api.post(`/torrent/${torrentId}/like`);
|
| export const addTorrentComment = (torrentId, commentData) => {
|
| return api.post(`/torrent/${torrentId}/comments`, commentData);
|