install.ts 433 B

123456789101112131415
  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. try {
  7. const { locales } = await Get(url ?? `${Locale_URL}/applet.${ENV}.json`, { notTransform: true, shareRequest: true });
  8. return cache = flatRecordKeys(locales), cache;
  9. } catch (error) {
  10. return null;
  11. }
  12. }