mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
refactor: impl structs methods
This commit is contained in:
@@ -13,8 +13,8 @@ export async function getAxios() {
|
||||
try {
|
||||
const info = await getClashInfo();
|
||||
|
||||
if (info?.controller?.server) server = info?.controller?.server;
|
||||
if (info?.controller?.secret) secret = info?.controller?.secret;
|
||||
if (info?.server) server = info?.server;
|
||||
if (info?.secret) secret = info?.secret;
|
||||
} catch {}
|
||||
|
||||
axiosIns = axios.create({
|
||||
@@ -29,7 +29,7 @@ export async function getAxios() {
|
||||
export async function getInfomation() {
|
||||
if (server) return { server, secret };
|
||||
const info = await getClashInfo();
|
||||
return info?.controller!;
|
||||
return info!;
|
||||
}
|
||||
|
||||
/// Get Version
|
||||
|
||||
@@ -2,7 +2,7 @@ import { invoke } from "@tauri-apps/api/tauri";
|
||||
import { ApiType, CmdType } from "./types";
|
||||
|
||||
export async function getProfiles() {
|
||||
return (await invoke<CmdType.ProfilesConfig>("get_profiles")) ?? {};
|
||||
return invoke<CmdType.ProfilesConfig>("get_profiles");
|
||||
}
|
||||
|
||||
export async function syncProfiles() {
|
||||
|
||||
@@ -80,8 +80,9 @@ export namespace ApiType {
|
||||
export namespace CmdType {
|
||||
export interface ClashInfo {
|
||||
status: string;
|
||||
controller?: { server?: string; secret?: string };
|
||||
message?: string;
|
||||
port?: string;
|
||||
server?: string;
|
||||
secret?: string;
|
||||
}
|
||||
|
||||
export interface ProfileItem {
|
||||
|
||||
Reference in New Issue
Block a user