* 取 msg(命名为 fetch 而非 get 主要是因为是远程操作) * @param {String} options.author 作者名 * @param {Number} options.pageIdx 目标页码(默认是第 1 页) * @param {Number} options.quantity 单页请求 msg 的数量(默认每页显示 10 条) * @param {Number} options.msgId * @return {Promise}
({ author = '', pageIdx = 1, quantity = 10, msgId } = {})
| 12 | * @return {Promise} |
| 13 | */ |
| 14 | fetch ({ author = '', pageIdx = 1, quantity = 10, msgId } = {}) { |
| 15 | let url = '/msg/' |
| 16 | |
| 17 | if (msgId) { |
| 18 | url += msgId |
| 19 | } else { |
| 20 | url = `${url}?author=${author}&pageIdx=${pageIdx}&quantity=${quantity}` |
| 21 | } |
| 22 | |
| 23 | return xhr({ url }) |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * 新增 msg |
no test coverage detected