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

View File

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

View File

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