Fix: setting page error

This commit is contained in:
Dreamacro 2018-12-08 22:47:46 +08:00
parent 3bf124dbb3
commit 6f2e74fced
3 changed files with 7 additions and 7 deletions

View File

@ -13,8 +13,8 @@ import { isClashX, jsBridge } from '@lib/jsBridge'
class Settings extends React.Component<I18nProps, {}> {
state = {
startAtLogin: false,
setAsSystemProxy: true,
allowConnectFromLan: true,
setAsSystemProxy: false,
allowConnectFromLan: false,
proxyMode: 'Rule',
socks5ProxyPort: 7891,
httpProxyPort: 7890,
@ -51,7 +51,7 @@ class Settings extends React.Component<I18nProps, {}> {
}
handleHttpPortSave = async () => {
const [, err] = await to(updateConfig({ 'redir-port': this.state.httpProxyPort }))
const [, err] = await to(updateConfig({ 'port': this.state.httpProxyPort }))
if (err === null) {}
}
@ -182,7 +182,7 @@ class Settings extends React.Component<I18nProps, {}> {
<Col span={3} offset={3}>
<Input
value={socks5ProxyPort}
onChange={socks5ProxyPort => this.setState({ socks5ProxyPort })}
onChange={socks5ProxyPort => this.setState({ socks5ProxyPort: parseInt(socks5ProxyPort, 10) })}
onBlur={this.handleSocksPortSave}
/>
</Col>
@ -194,7 +194,7 @@ class Settings extends React.Component<I18nProps, {}> {
<Col span={3} offset={2}>
<Input
value={httpProxyPort}
onChange={httpProxyPort => this.setState({ httpProxyPort })}
onChange={httpProxyPort => this.setState({ httpProxyPort: parseInt(httpProxyPort, 10) })}
onBlur={this.handleHttpPortSave}
/>
</Col>

View File

@ -119,7 +119,7 @@ export class JsBridge {
return new Promise<T>((resolve) => {
this.instance.callHandler(
handleName,
data || undefined,
data,
resolve
)
})

View File

@ -39,7 +39,7 @@ export async function getConfig () {
export async function updateConfig (config: Partial<Config>) {
const req = await getInstance()
return req.put<void>('configs', config)
return req.patch<void>('configs', config)
}
export async function getRules () {