config.ts 476 B

123456789101112131415161718192021
  1. import axios from 'axios';
  2. const service = axios.create({
  3. timeout: 6000,
  4. });
  5. export interface ConfigParams {
  6. isDev: boolean;
  7. webSiteUrl: string;
  8. webApiServiceUrl: string
  9. }
  10. export const getConfig = async <ConfigParams>(
  11. ): Promise<ConfigParams> => {
  12. try {
  13. const res = await service.request({url: '../hzyz/mobile/appconfig.json'});
  14. return res.data as ConfigParams;
  15. } catch (error: any) {
  16. return Promise.reject(null);
  17. }
  18. };