You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailchat/client/shared/model/config.ts

44 lines
849 B
TypeScript

import { request } from '../api/request';
import { useGlobalConfigStore } from '../store/globalConfig';
import { defaultGlobalConfig } from '../utils/consts';
/**
*
*/
export interface GlobalConfig {
/**
*
* 1m
*/
uploadFileLimit: number;
/**
*
*/
emailVerification: boolean;
/**
*
*/
serverName?: string;
/**
*
*/
serverEntryImage?: string;
}
export function getGlobalConfig(): GlobalConfig {
return useGlobalConfigStore.getState();
}
export async function fetchGlobalClientConfig(): Promise<GlobalConfig> {
const { data: config } = await request.get('/api/config/client');
useGlobalConfigStore.setState({
...defaultGlobalConfig,
...config,
});
return config;
}