answerchat.js 1023 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import Vue from 'vue';
  2. import Vuex from 'vuex';
  3. import _ from 'lodash';
  4. Vue.use(Vuex);
  5. const api = {
  6. answerchatInfo: `/api/train/answerchat`,
  7. };
  8. const state = () => ({});
  9. const mutations = {};
  10. const actions = {
  11. async query({ commit }, { skip = 0, limit, ...info } = {}) {
  12. const res = await this.$axios.$get(`${api.answerchatInfo}`, { skip, limit, ...info });
  13. return res;
  14. },
  15. async create({ commit }, payload) {
  16. const res = await this.$axios.$post(`${api.answerchatInfo}`, payload);
  17. return res;
  18. },
  19. async fetch({ commit }, payload) {
  20. const res = await this.$axios.$get(`${api.answerchatInfo}/${payload}`);
  21. return res;
  22. },
  23. async update({ commit }, { id, ...data }) {
  24. const res = await this.$axios.$post(`${api.answerchatInfo}/update/${id}`, data);
  25. return res;
  26. },
  27. async delete({ commit }, payload) {
  28. const res = await this.$axios.$delete(`${api.answerchatInfo}/${payload}`);
  29. return res;
  30. },
  31. };
  32. export default {
  33. namespaced: true,
  34. state,
  35. mutations,
  36. actions,
  37. };