mirror of https://github.com/msgbyte/tailchat
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.
34 lines
547 B
TypeScript
34 lines
547 B
TypeScript
import { request } from '../api/request';
|
|
|
|
/**
|
|
* 后端的全局设置
|
|
*/
|
|
export interface GlobalConfig {
|
|
/**
|
|
* 上传文件体积
|
|
* 默认1m
|
|
*/
|
|
uploadFileLimit: number;
|
|
}
|
|
|
|
let globalConfig = {
|
|
uploadFileLimit: 1 * 1024 * 1024,
|
|
};
|
|
|
|
export function getGlobalConfig() {
|
|
return {
|
|
...globalConfig,
|
|
};
|
|
}
|
|
|
|
export async function fetchGlobalClientConfig(): Promise<GlobalConfig> {
|
|
const { data: config } = await request.get('/api/config/client');
|
|
|
|
globalConfig = {
|
|
...globalConfig,
|
|
...config,
|
|
};
|
|
|
|
return config;
|
|
}
|