diff --git a/www/components/frpc_card.tsx b/www/components/frpc_card.tsx index ae2766e..f45187e 100644 --- a/www/components/frpc_card.tsx +++ b/www/components/frpc_card.tsx @@ -11,6 +11,7 @@ import { FRPCEditor } from './frpc_editor' import { FRPCForm } from './frpc_form' import { useSearchParams } from 'next/navigation' import { $clientProxyConfigs } from '@/store/proxy' +import { ClientConfig } from '@/types/client' export interface FRPCFormCardProps { clientID?: string @@ -68,8 +69,20 @@ export const FRPCFormCard: React.FC = ({ setClientID(paramClientID) setServerID(client?.client?.serverId) } - $clientProxyConfigs.set([]) - }, [paramClientID, client]) + + if (!client || !client?.client || !client?.client?.config) return + const proxyConfs = (JSON.parse(client?.client?.config) as ClientConfig).proxies + if (proxyConfs) { + $clientProxyConfigs.set(proxyConfs) + } + + }, [paramClientID]) + + useEffect(() => { + if (clientID) { + setServerID(client?.client?.serverId) + } + }, [clientID, paramClientID, client]) return ( diff --git a/www/components/frpc_form.tsx b/www/components/frpc_form.tsx index 0251839..9ddcd0f 100644 --- a/www/components/frpc_form.tsx +++ b/www/components/frpc_form.tsx @@ -84,7 +84,6 @@ export const FRPCForm: React.FC = ({ clientID, serverID }) => { clientId: clientID, }) await refetchClient() - $clientProxyConfigs.set([]) toast({ title: '更新隧道状态', description: res.status?.code === RespCode.SUCCESS ? '更新成功' : '更新失败' }) } catch (error) { console.error(error)