statistics.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { defineStore } from 'pinia'
  2. import { AxiosWrapper } from '@/utils/axios-wrapper'
  3. const url = '/statistics'
  4. const axios = new AxiosWrapper()
  5. export const StatisticsStore = defineStore('statistics', () => {
  6. const work = async ({ skip = 0, limit = undefined, ...info } = {}) => {
  7. let cond = {}
  8. if (skip) cond.skip = skip
  9. if (limit) cond.limit = limit
  10. cond = { ...cond, ...info }
  11. const res = await axios.$get(`${url}`, cond)
  12. return res
  13. }
  14. const user = async ({ skip = 0, limit = undefined, ...info } = {}) => {
  15. let cond = {}
  16. if (skip) cond.skip = skip
  17. if (limit) cond.limit = limit
  18. cond = { ...cond, ...info }
  19. const res = await axios.$get(`${url}`, cond)
  20. return res
  21. }
  22. const resource = async ({ skip = 0, limit = undefined, ...info } = {}) => {
  23. let cond = {}
  24. if (skip) cond.skip = skip
  25. if (limit) cond.limit = limit
  26. cond = { ...cond, ...info }
  27. const res = await axios.$get(`${url}`, cond)
  28. return res
  29. }
  30. return {
  31. work,
  32. user,
  33. resource
  34. }
  35. })