diff options
| author | Haishan <[email protected]> | 2018-12-04 23:39:26 +0800 |
|---|---|---|
| committer | Haishan <[email protected]> | 2018-12-07 00:19:49 +0800 |
| commit | 3584ff617966af35ddd0fd45ef2df7cdfb8f5071 (patch) | |
| tree | 83f4f535d1fd3ca1c85807a1c2b397cf9b6733c5 /src/components/Logs.js | |
| parent | a265c62020d4dd3a4e57e5ad0894794461dd8385 (diff) | |
feat: initial theming support
Diffstat (limited to 'src/components/Logs.js')
| -rw-r--r-- | src/components/Logs.js | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/components/Logs.js b/src/components/Logs.js index 235e7ba..08d634f 100644 --- a/src/components/Logs.js +++ b/src/components/Logs.js @@ -1,9 +1,12 @@ import React, { useState, useEffect } from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames'; +import { useComponentState } from 'm/store'; +import { getClashAPIConfig } from 'd/app'; import Icon from 'c/Icon'; import ContentHeader from 'c/ContentHeader'; +// TODO move this into a redux action import { fetchLogs } from '../api/logs'; import yacd from 's/yacd.svg'; @@ -42,12 +45,16 @@ LogLine.propTypes = { export default function Logs() { const [logs, setLogs] = useState([]); + const { apiConfig } = useComponentState(getClashAPIConfig); - useEffect(() => { - const x = fetchLogs(); - setLogs(x.logs); - return x.subscribe(() => setLogs(x.logs)); - }, []); + useEffect( + () => { + const x = fetchLogs(apiConfig); + setLogs(x.logs); + return x.subscribe(() => setLogs(x.logs)); + }, + [apiConfig.hostname, apiConfig.port, apiConfig.secret] + ); return ( <div> |
