api相对路径

This commit is contained in:
Rewrite0
2023-04-26 11:38:00 +08:00
parent a2d97c1b46
commit 10854f06ea
3 changed files with 7 additions and 7 deletions

View File

@@ -2,11 +2,11 @@ import axios from 'axios';
import type { Config } from '#/config';
export async function setConfig(newConfig: Config) {
const { data } = await axios.post('/api/v1/updateConfig', newConfig);
const { data } = await axios.post('api/v1/updateConfig', newConfig);
return data;
}
export async function getConfig() {
const { data } = await axios.get<Config>('/api/v1/getConfig');
const { data } = await axios.get<Config>('api/v1/getConfig');
return data;
}

View File

@@ -1,16 +1,16 @@
import axios from 'axios';
/** 重启 */
export const appRestart = () => axios.get('/api/v1/restart');
export const appRestart = () => axios.get('api/v1/restart');
/** 启动 */
export const appStart = () => axios.get('/api/v1/start');
export const appStart = () => axios.get('api/v1/start');
/** 停止 */
export const appStop = () => axios.get('/api/v1/stop');
export const appStop = () => axios.get('api/v1/stop');
/** 状态 */
export async function appStatus() {
const { data } = await axios.get('/api/v1/getStatus');
const { data } = await axios.get('api/v1/getStatus');
return data;
}

View File

@@ -35,7 +35,7 @@ export default defineConfig({
server: {
host: '0.0.0.0',
proxy: {
'/api': 'http://127.0.0.1:7892',
'^/api/.*': 'http://127.0.0.1:7892',
},
},
});