riku
2024-07-26 1a4d35a08d05e014663c144771976abb0edaa933
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
 * 从服务器加载动态配置
 */
 
import { fetchSceneTypes, fetchUserConfig } from '../services/config/fetchConfig';
 
const app = getApp();
 
function loadConfig() {
  const pList = [];
 
  const userId = app.globalData.accessToken.userId;
  const f1 = fetchSceneTypes({ userId }).then(res => {
    wx.setStorage({
      key: 'scene_types',
      data: res.data,
    });
  });
 
  const f2 = fetchUserConfig({ userId });
  
  pList.push(f1, f2);
  return Promise.all(pList);
}
 
export { loadConfig };