mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-17 17:54:32 +08:00
修改获取配置文件接口,初始化系统配置
This commit is contained in:
@@ -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 = () => {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -3,6 +3,7 @@ const baseUrl = window.__ENV__QlBaseUrl || '/';
|
||||
|
||||
export default {
|
||||
siteName: intl.get('青龙'),
|
||||
baseUrl,
|
||||
apiPrefix: `${baseUrl}api/`,
|
||||
authKey: 'token',
|
||||
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
import * as Sentry from '@sentry/react';
|
||||
import { loader } from '@monaco-editor/react';
|
||||
import config from './config';
|
||||
|
||||
export function init(version: string) {
|
||||
// sentry监控 init
|
||||
@@ -26,7 +27,7 @@ export function init(version: string) {
|
||||
// monaco 编辑器配置cdn和locale
|
||||
loader.config({
|
||||
paths: {
|
||||
vs: '/monaco-editor/min/vs',
|
||||
vs: `${config.baseUrl}monaco-editor/min/vs`,
|
||||
},
|
||||
'vs/nls': {
|
||||
availableLanguages: {
|
||||
|
||||
Reference in New Issue
Block a user