-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue #467
- Loading branch information
Showing
11 changed files
with
437 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,59 @@ export function createTopic (data) { | |
const url = '/feed/topics' | ||
return api.post(url, data, { validateStatus: s => s === 201 }) | ||
} | ||
|
||
/** | ||
* 获取动态详情 | ||
* | ||
* @author mutoe <[email protected]> | ||
* @export | ||
* @param {number} topicId | ||
* @returns | ||
*/ | ||
export function getTopicDetail (topicId) { | ||
const url = `/feed/topics/${topicId}` | ||
return api.get(url, { validateStatus: s => s === 200 }) | ||
} | ||
|
||
/** | ||
* 获取话题相关动态 | ||
* | ||
* @author mutoe <[email protected]> | ||
* @export | ||
* @param {number} topicId | ||
* @param {Object} params | ||
* @param {Object} [params.limit=15] | ||
* @param {Object} [params.direction=desc] | ||
* @param {Object} [params.index=0] | ||
* @returns {FeedObject[]} | ||
*/ | ||
export function getTopicFeeds (topicId, params) { | ||
const url = `/feed/topics/${topicId}/feeds` | ||
return api.get(url, { params, validateStatus: s => s === 200 }) | ||
} | ||
|
||
/** | ||
* 关注话题 | ||
* | ||
* @author mutoe <[email protected]> | ||
* @export | ||
* @param {number} topicId | ||
* @returns | ||
*/ | ||
export function followTopic (topicId) { | ||
const url = `/user/feed-topics/${topicId}` | ||
return api.put(url, {}, { validateStatus: s => s === 204 }) | ||
} | ||
|
||
/** | ||
* 取消关注话题 | ||
* | ||
* @author mutoe <[email protected]> | ||
* @export | ||
* @param {number} topicId | ||
* @returns | ||
*/ | ||
export function unfollowTopic (topicId) { | ||
const url = `/user/feed-topics/${topicId}` | ||
return api.delete(url, { validateStatus: s => s === 204 }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.