frpc-desktop/electron/controller/ServerController.ts

29 lines
744 B
TypeScript
Raw Normal View History

import BaseController from "./BaseController";
import ServerService from "../service/ServerService";
2025-02-21 18:30:13 +08:00
import { success } from "../utils/response";
class ServerController extends BaseController {
2025-02-21 18:30:13 +08:00
private readonly _serverService: ServerService;
constructor(serverService: ServerService) {
super();
2025-02-21 18:30:13 +08:00
this._serverService = serverService;
}
2025-02-21 18:30:13 +08:00
saveConfig(req: ControllerParam) {
this._serverService.saveServerConfig(req.args).then(() => {
req.event.reply(req.channel, success());
})
2025-02-21 18:30:13 +08:00
}
getServerConfig(req: ControllerParam) {
console.log("get", req.args);
this._serverService.getServerConfig().then(data => {
req.event.reply(req.channel, success(data));
});
}
}
export default ServerController;