admin.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* eslint no-param-reassign: 0 */
  2. /* eslint-disable import/no-cycle */
  3. import admin from "@/api/admin/index";
  4. const modules = {
  5. songs: {
  6. namespaced: true,
  7. state: {},
  8. getters: {},
  9. actions: {},
  10. mutations: {}
  11. },
  12. stations: {
  13. namespaced: true,
  14. state: {},
  15. getters: {},
  16. actions: {},
  17. mutations: {}
  18. },
  19. reports: {
  20. namespaced: true,
  21. state: {},
  22. getters: {},
  23. actions: {
  24. /* eslint-disable-next-line no-unused-vars */
  25. resolveReport: ({ commit }, { reportId, value }) =>
  26. new Promise((resolve, reject) => {
  27. admin.reports
  28. .resolve({ reportId, value })
  29. .then(res => resolve(res))
  30. .catch(err => reject(new Error(err.message)));
  31. }),
  32. /* eslint-disable-next-line no-unused-vars */
  33. removeReport: ({ commit }, reportId) =>
  34. new Promise((resolve, reject) => {
  35. admin.reports
  36. .remove(reportId)
  37. .then(res => resolve(res))
  38. .catch(err => reject(new Error(err.message)));
  39. })
  40. },
  41. mutations: {}
  42. },
  43. users: {
  44. namespaced: true,
  45. state: {},
  46. getters: {},
  47. actions: {},
  48. mutations: {}
  49. },
  50. news: {
  51. namespaced: true,
  52. state: {},
  53. getters: {},
  54. actions: {},
  55. mutations: {}
  56. },
  57. playlists: {
  58. namespaced: true,
  59. state: {},
  60. getters: {},
  61. actions: {},
  62. mutations: {}
  63. }
  64. };
  65. export default {
  66. namespaced: true,
  67. state: {
  68. childrenActive: {
  69. users: false
  70. }
  71. },
  72. getters: {},
  73. actions: {
  74. toggleChildren({ commit }, payload) {
  75. commit("toggleChildren", payload);
  76. }
  77. },
  78. mutations: {
  79. toggleChildren(state, payload) {
  80. if (typeof payload.force === "undefined")
  81. state.childrenActive[payload.child] =
  82. !state.childrenActive[payload.child];
  83. else state.childrenActive[payload.child] = payload.force;
  84. }
  85. },
  86. modules
  87. };