部分重型模块的原子化拆解
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
// modules/frpc.js
|
||||
import { apiFetch } from './api.js';
|
||||
|
||||
export async function getFrpcStatus() {
|
||||
try {
|
||||
const data = await apiFetch('/frpc/status');
|
||||
if (data.code === 0) {
|
||||
return data.data.running || false;
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('获取 frpc 状态失败', e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export async function reloadFrpc() {
|
||||
const data = await apiFetch('/frpc/reload', { method: 'POST' });
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function startFrpc() {
|
||||
const data = await apiFetch('/frpc/start', { method: 'POST' });
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function stopFrpc() {
|
||||
const data = await apiFetch('/frpc/stop', { method: 'POST' });
|
||||
return data;
|
||||
}
|
||||
Reference in New Issue
Block a user