mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-02 12:48:30 +00:00
27 lines
682 B
TypeScript
27 lines
682 B
TypeScript
import { getSystemInitData } from '@/web/common/system/api';
|
|
import { delay } from '@fastgpt/global/common/system/utils';
|
|
import type { FastGPTFeConfigsType } from '@fastgpt/global/common/system/types/index.d';
|
|
|
|
import { useSystemStore } from './useSystemStore';
|
|
|
|
export const clientInitData = async (
|
|
retry = 3
|
|
): Promise<{
|
|
feConfigs: FastGPTFeConfigsType;
|
|
}> => {
|
|
try {
|
|
const res = await getSystemInitData();
|
|
useSystemStore.getState().initStaticData(res);
|
|
|
|
return {
|
|
feConfigs: res.feConfigs || {}
|
|
};
|
|
} catch (error) {
|
|
if (retry > 0) {
|
|
await delay(500);
|
|
return clientInitData(retry - 1);
|
|
}
|
|
return Promise.reject(error);
|
|
}
|
|
};
|