Skip to content

Commit

Permalink
fix: refetch
Browse files Browse the repository at this point in the history
  • Loading branch information
VaalaCat committed May 12, 2024
1 parent 5fe417a commit 3f3de74
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
17 changes: 15 additions & 2 deletions www/components/frpc_card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -68,8 +69,20 @@ export const FRPCFormCard: React.FC<FRPCFormCardProps> = ({
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 (
<Card className="w-full">
Expand Down
1 change: 0 additions & 1 deletion www/components/frpc_form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ export const FRPCForm: React.FC<FRPCFormProps> = ({ clientID, serverID }) => {
clientId: clientID,
})
await refetchClient()
$clientProxyConfigs.set([])
toast({ title: '更新隧道状态', description: res.status?.code === RespCode.SUCCESS ? '更新成功' : '更新失败' })
} catch (error) {
console.error(error)
Expand Down

0 comments on commit 3f3de74

Please sign in to comment.