This repository has been archived by the owner on Nov 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
48 additions
and
33 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { get, limit } from "./api.js"; | ||
const uri = "/user/news/contributes"; | ||
import api, { limit } from "./api.js"; | ||
|
||
/** | ||
* 获取当前用户投稿列表 | ||
* @Author Wayne | ||
|
@@ -9,7 +9,7 @@ const uri = "/user/news/contributes"; | |
* @return [Promise] | ||
*/ | ||
export function getMyNews({ type = 0, limit = 15, after = 0 }) { | ||
return get(uri, { | ||
return api.get("/user/news/contributes", { | ||
type, | ||
limit, | ||
after | ||
|
@@ -27,7 +27,7 @@ export function getMyNews({ type = 0, limit = 15, after = 0 }) { | |
export function searchNewsByKey(key = "", limit = 15, after = 0) { | ||
return !key | ||
? Promise.resolve([]) | ||
: get(`/news?key=${key}&limit=${limit}&after=${after}`).then( | ||
: api.get(`/news?key=${key}&limit=${limit}&after=${after}`).then( | ||
({ data = [] }) => { | ||
return data; | ||
}, | ||
|
@@ -39,8 +39,22 @@ export function searchNewsByKey(key = "", limit = 15, after = 0) { | |
} | ||
|
||
export function getNewsCommentPinneds(after = 0) { | ||
return get("/news/comments/pinneds", { | ||
return api.get("/news/comments/pinneds", { | ||
limit, | ||
after | ||
}); | ||
} | ||
|
||
/** | ||
* 删除评论 | ||
* @author mutoe <[email protected]> | ||
* @export | ||
* @param {Number} newsId 资讯 id | ||
* @param {Number} commentId 评论 id | ||
* @returns {Promise} | ||
*/ | ||
export function deleteNewsComment(newsId, commentId) { | ||
return api.delete(`/news/${newsId}/comments/${commentId}`, { | ||
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