configStore.js 574 B

1234567891011121314151617181920212223242526272829303132
  1. import { defineStore } from 'pinia';
  2. import http from '../common/request'
  3. export default defineStore('configStore', {
  4. state: () => {
  5. return {
  6. webrtc: {}
  7. }
  8. },
  9. actions: {
  10. setConfig(config) {
  11. this.webrtc = config.webrtc;
  12. },
  13. clear() {
  14. this.webrtc = {};
  15. },
  16. loadConfig() {
  17. return new Promise((resolve, reject) => {
  18. http({
  19. url: '/system/config',
  20. method: 'GET'
  21. }).then((config) => {
  22. console.log("系统配置", config)
  23. this.setConfig(config);
  24. resolve();
  25. }).catch((res) => {
  26. reject(res);
  27. });
  28. })
  29. }
  30. }
  31. })