From 795b8ec1d0e48d41a39574c69f0511f30da01e25 Mon Sep 17 00:00:00 2001 From: m1m1sha <18262227804@163.com> Date: Sun, 5 May 2024 23:12:54 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=88=20perf:=20=E6=8B=86=E5=88=86compos?= =?UTF-8?q?able?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- easytier-gui/src/composables/network.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 easytier-gui/src/composables/network.ts diff --git a/easytier-gui/src/composables/network.ts b/easytier-gui/src/composables/network.ts new file mode 100644 index 0000000..a59f8e0 --- /dev/null +++ b/easytier-gui/src/composables/network.ts @@ -0,0 +1,22 @@ +import { NetworkConfig } from "~/types/network"; +import { invoke } from "@tauri-apps/api/tauri"; + +export async function parseNetworkConfig(cfg: NetworkConfig): Promise { + const ret: string = await invoke("parse_network_config", { cfg: JSON.stringify(cfg) }); + return ret; +} + +export async function runNetworkInstance(cfg: NetworkConfig) { + const ret: string = await invoke("run_network_instance", { cfg: JSON.stringify(cfg) }); + return ret; +} + +export async function retainNetworkInstance(instanceIds: Array) { + const ret: string = await invoke("retain_network_instance", { instanceIds: JSON.stringify(instanceIds) }); + return ret; +} + +export async function collectNetworkInfos() { + const ret: string = await invoke("collect_network_infos", {}); + return JSON.parse(ret); +}