mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-02-03 03:10:50 +08:00
feat: initialize new React application structure with TypeScript, ESLint, and Prettier configurations, while removing legacy files and adding new components and pages for enhanced functionality
This commit is contained in:
27
src/services/api/configFile.ts
Normal file
27
src/services/api/configFile.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 配置文件相关 API(/config.yaml)
|
||||
*/
|
||||
|
||||
import { apiClient } from './client';
|
||||
|
||||
export const configFileApi = {
|
||||
async fetchConfigYaml(): Promise<string> {
|
||||
const response = await apiClient.getRaw('/config.yaml', {
|
||||
responseType: 'text',
|
||||
headers: { Accept: 'application/yaml, text/yaml, text/plain' }
|
||||
});
|
||||
const data = response.data as any;
|
||||
if (typeof data === 'string') return data;
|
||||
if (data === undefined || data === null) return '';
|
||||
return String(data);
|
||||
},
|
||||
|
||||
async saveConfigYaml(content: string): Promise<void> {
|
||||
await apiClient.put('/config.yaml', content, {
|
||||
headers: {
|
||||
'Content-Type': 'application/yaml',
|
||||
Accept: 'application/json, text/plain, */*'
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user