personalroom.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import Vue from 'vue';
  2. import Vuex from 'vuex';
  3. import _ from 'lodash';
  4. Vue.use(Vuex);
  5. const api = {
  6. interface: `/api/live/personroom`,
  7. roomCountDelete: id => `/api/live/personroomtalk/${id}`,
  8. roomCount: `/api/live/personroomtalk/countroom`,
  9. };
  10. const state = () => ({});
  11. const mutations = {};
  12. const actions = {
  13. async query({ commit }, { skip = 0, limit = undefined, ...info } = {}) {
  14. const res = await this.$axios.$get(api.interface, { skip, limit, ...info });
  15. return res;
  16. },
  17. async create({ commit }, payload) {
  18. const res = await this.$axios.$post(`${api.interface}`, payload);
  19. return res;
  20. },
  21. async fetch({ commit }, payload) {
  22. const res = await this.$axios.$get(`${api.interface}/${payload}`);
  23. return res;
  24. },
  25. async update({ commit }, { id, ...info } = {}) {
  26. const res = await this.$axios.$post(`${api.interface}/${id}`, { ...info });
  27. return res;
  28. },
  29. async delete({ commit }, payload) {
  30. const res = await this.$axios.$delete(`${api.interface}/${payload}`);
  31. return res;
  32. },
  33. async countRoom({ commit }, payload) {
  34. const res = await this.$axios.$get(api.roomCount);
  35. return res;
  36. },
  37. async countDelete({ commit }, payload) {
  38. const res = await this.$axios.$delete(api.roomCountDelete(payload));
  39. return res;
  40. },
  41. };
  42. export default {
  43. namespaced: true,
  44. state,
  45. mutations,
  46. actions,
  47. };