修改获取配置文件接口,初始化系统配置

This commit is contained in:
whyour
2024-01-18 13:51:06 +08:00
parent 1a94a660a5
commit 8283f62db2
9 changed files with 30 additions and 21 deletions
+7 -5
View File
@@ -30,11 +30,13 @@ const Config = () => {
const [language, setLanguage] = useState<string>('shell');
const getConfig = (name: string) => {
request.get(`${config.apiPrefix}configs/${name}`).then(({ code, data }) => {
if (code === 200) {
setValue(data);
}
});
request
.get(`${config.apiPrefix}configs/detail?path=${encodeURIComponent(name)}`)
.then(({ code, data }) => {
if (code === 200) {
setValue(data);
}
});
};
const getFiles = () => {
+2 -2
View File
@@ -26,7 +26,7 @@ const Diff = () => {
const getConfig = () => {
request
.get(`${config.apiPrefix}configs/${encodeURIComponent(current)}`)
.get(`${config.apiPrefix}configs/detail?path=${encodeURIComponent(current)}`)
.then(({ code, data }) => {
if (code === 200) {
setCurrentValue(data);
@@ -36,7 +36,7 @@ const Diff = () => {
const getSample = () => {
request
.get(`${config.apiPrefix}configs/${encodeURIComponent(origin)}`)
.get(`${config.apiPrefix}configs/detail?path=${encodeURIComponent(origin)}`)
.then(({ code, data }) => {
if (code === 200) {
setOriginValue(data);