appConfig.js 841 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. const state = {
  2. appConfig: {
  3. title: "Loading...",
  4. appBarColor: "#114514",
  5. telwsUrl: "/api/telws/",
  6. projectName: "Loading...",
  7. projectDescription: "Loading..."
  8. }
  9. }
  10. const getters = {
  11. getTitle: (st) => () => st.appConfig.title,
  12. getAppBarColor: (st) => () => st.appConfig.appBarColor,
  13. getTelwsUrl: (st) => () => st.appConfig.telwsUrl,
  14. getProjectName: (st) => () => st.appConfig.projectName,
  15. getProjectDescription: (st) => () => st.appConfig.projectDescription,
  16. }
  17. const types = {
  18. setConfig: "setConfig"
  19. }
  20. const mutations = {
  21. [types.setConfig](st, cfg) {
  22. st.appConfig = cfg
  23. }
  24. }
  25. const actions = {
  26. setConfig({ commit }, cfg) {
  27. commit(types.setConfig, cfg)
  28. }
  29. }
  30. export default {
  31. state,
  32. getters,
  33. types,
  34. mutations,
  35. actions
  36. }