install.ts 456 B

12345678910111213141516
  1. import { Locale_URL, ENV } from '../app.config';
  2. import { Get } from '../lib/request/method';
  3. import { flatRecordKeys } from './tool';
  4. let cache = null;
  5. export default async function request(url?: string) {
  6. let env = 'release';
  7. try {
  8. const { locales } = await Get(url ?? `${Locale_URL}/applet.${env}.json`, { notTransform: true, shareRequest: true });
  9. return cache = flatRecordKeys(locales), cache;
  10. } catch (error) {
  11. return null;
  12. }
  13. }