1
0

category.js 940 B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * 分类接口
  3. * @see https://api.halo.run/content-api.html#tag/category-controller
  4. */
  5. import HttpHandler from '@/common/http/request.js'
  6. import { getCache } from '@/utils/storage.js'
  7. export default {
  8. /**
  9. * 查询分类列表
  10. * @param {Object} params 查询参数
  11. */
  12. getCategoryList: (params) => {
  13. return HttpHandler.Get('/apis/api.content.halo.run/v1alpha1/categories', params)
  14. },
  15. /**
  16. * 根据分类名称查询一个分类
  17. * @param {String} name 分类名称
  18. * @param {Object} params 查询参数
  19. */
  20. getCategoryPostList: (name, params) => {
  21. return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/categories/${name}`, params)
  22. },
  23. /**
  24. * 查询分类下的文章
  25. * @param {String} name 分类名称
  26. * @param {Object} params 查询参数
  27. */
  28. getCategoryPostList: (name, params) => {
  29. return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/categories/${name}/posts`, params)
  30. },
  31. }