Skip to content

Commit

Permalink
feat: add refresh button
Browse files Browse the repository at this point in the history
  • Loading branch information
songquanpeng committed May 15, 2023
1 parent aae9268 commit 44ebae1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion web/src/components/ChannelsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ const ChannelsTable = () => {
})();
};

const refresh = async () => {
setLoading(true);
await loadChannels(0);
}

useEffect(() => {
loadChannels(0)
.then()
Expand Down Expand Up @@ -174,7 +179,7 @@ const ChannelsTable = () => {
const res = await API.get(`/api/channel/test`);
const { success, message } = res.data;
if (success) {
showSuccess("已成功开始测试所有已启用通道,请刷新页面查看结果。");
showInfo("已成功开始测试所有已启用通道,请刷新页面查看结果。");
} else {
showError(message);
}
Expand Down Expand Up @@ -359,6 +364,7 @@ const ChannelsTable = () => {
(channels.length % ITEMS_PER_PAGE === 0 ? 1 : 0)
}
/>
<Button size='small' onClick={refresh} loading={loading}>刷新</Button>
</Table.HeaderCell>
</Table.Row>
</Table.Footer>
Expand Down
6 changes: 6 additions & 0 deletions web/src/components/TokensTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ const TokensTable = () => {
})();
};

const refresh = async () => {
setLoading(true);
await loadTokens(0);
}

useEffect(() => {
loadTokens(0)
.then()
Expand Down Expand Up @@ -334,6 +339,7 @@ const TokensTable = () => {
<Button size='small' as={Link} to='/token/add' loading={loading}>
添加新的令牌
</Button>
<Button size='small' onClick={refresh} loading={loading}>刷新</Button>
<Pagination
floated='right'
activePage={activePage}
Expand Down

0 comments on commit 44ebae1

Please sign in to comment.