31 lines
685 B
JavaScript
31 lines
685 B
JavaScript
import client from './client';
|
|
|
|
export const postApi = {
|
|
list({ page = 1, limit = 10, keyword = '' } = {}) {
|
|
return client.get('/posts', {
|
|
params: {
|
|
page,
|
|
limit,
|
|
keyword: keyword.trim()
|
|
}
|
|
});
|
|
},
|
|
|
|
play(id) {
|
|
return client.get(`/posts/${id}/play`);
|
|
},
|
|
show(id) {
|
|
return client.get(`/posts/${id}/show`);
|
|
},
|
|
mine({ page = 1, limit = 10 } = {}) {
|
|
return client.get('/posts/mine', {
|
|
params: {
|
|
page,
|
|
limit
|
|
}
|
|
});
|
|
},
|
|
buy(id) {
|
|
return client.post(`/posts/buy/${id}`);
|
|
}
|
|
} |