CommentsService.js 860 B

12345678910111213141516171819202122232425262728293031323334
  1. import axios from "axios";
  2. const CommentsService = axios.create({
  3. withCredentials: true,
  4. baseURL: `https://api.amic.ru/api/v1/comments`,
  5. headers: {
  6. "key":"Accept",
  7. "value":"application/json",
  8. "description":"",
  9. "type":"text",
  10. "enabled":true
  11. },
  12. });
  13. export default {
  14. getCommentsList(pullId, pageNumber) {
  15. return CommentsService.get("/pull_" + pullId + (pageNumber ? 'page_' + pageNumber : ''))
  16. .then((CommentsList) => {
  17. return CommentsList.data.data
  18. })
  19. .catch((error) => {
  20. console.log(error)
  21. })
  22. },
  23. getLastCommentsList() {
  24. return CommentsService.get("/last")
  25. .then((lastCommentsList) => {
  26. return lastCommentsList.data.data
  27. })
  28. .catch((error) => {
  29. console.log(error)
  30. })
  31. }
  32. }