Files
Cli-Proxy-API-Management-Ce…/src/services/api/configFile.ts

28 lines
752 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 配置文件相关 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, */*'
}
});
}
};