mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
frontend: run prettier
This commit is contained in:
parent
258675b93a
commit
19dfd6d219
|
@ -16,15 +16,17 @@ export function queryOutboundIP(cb) {
|
|||
}
|
||||
|
||||
const triggerSync = async () => {
|
||||
return axios.post<any>(baseURL + '/api/environment/sync')
|
||||
}
|
||||
return axios.post<any>(baseURL + '/api/environment/sync');
|
||||
};
|
||||
|
||||
export { triggerSync };
|
||||
|
||||
export function querySyncStatus(cb) {
|
||||
return axios.get<any>(baseURL + '/api/environment/syncing').then((response) => {
|
||||
cb(response.data.syncing);
|
||||
});
|
||||
return axios
|
||||
.get<any>(baseURL + '/api/environment/syncing')
|
||||
.then((response) => {
|
||||
cb(response.data.syncing);
|
||||
});
|
||||
}
|
||||
|
||||
export function testDatabaseConnection(params, cb) {
|
||||
|
@ -99,9 +101,11 @@ export function querySessionSymbols(sessionName, cb) {
|
|||
}
|
||||
|
||||
export function queryTrades(params, cb) {
|
||||
axios.get<any>(baseURL + '/api/trades', { params: params }).then((response) => {
|
||||
cb(response.data.trades || []);
|
||||
});
|
||||
axios
|
||||
.get<any>(baseURL + '/api/trades', { params: params })
|
||||
.then((response) => {
|
||||
cb(response.data.trades || []);
|
||||
});
|
||||
}
|
||||
|
||||
export function queryClosedOrders(params, cb) {
|
||||
|
|
|
@ -9,9 +9,9 @@ import Container from '@mui/material/Container';
|
|||
import SideBar from '../components/SideBar';
|
||||
|
||||
import ConnectWallet from '../components/ConnectWallet';
|
||||
import { Box } from "@mui/material";
|
||||
import {throttle} from "../src/utils";
|
||||
import {triggerSync} from "../api/bbgo";
|
||||
import { Box } from '@mui/material';
|
||||
import { throttle } from '../src/utils';
|
||||
import { triggerSync } from '../api/bbgo';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
|
@ -30,26 +30,19 @@ const useStyles = makeStyles((theme) => ({
|
|||
container: {},
|
||||
toolbar: {
|
||||
justifyContent: 'space-between',
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
||||
const ToolbarButton = styled('button')(({ theme }) => ({
|
||||
padding: theme.spacing(1)
|
||||
})
|
||||
)
|
||||
padding: theme.spacing(1),
|
||||
}));
|
||||
|
||||
function SyncButton() {
|
||||
const handleClick = throttle(async () => {
|
||||
await triggerSync()
|
||||
}, 2000)
|
||||
await triggerSync();
|
||||
}, 2000);
|
||||
|
||||
return (
|
||||
<ToolbarButton
|
||||
onClick={handleClick}
|
||||
>
|
||||
Sync
|
||||
</ToolbarButton>
|
||||
);
|
||||
return <ToolbarButton onClick={handleClick}>Sync</ToolbarButton>;
|
||||
}
|
||||
|
||||
export default function DashboardLayout({ children }) {
|
||||
|
|
|
@ -29,9 +29,9 @@ export function throttle(fn, delayMillis) {
|
|||
let permitted = true;
|
||||
return () => {
|
||||
if (permitted) {
|
||||
fn.apply(this, arguments)
|
||||
permitted = false
|
||||
setTimeout(() => permitted = true, delayMillis)
|
||||
fn.apply(this, arguments);
|
||||
permitted = false;
|
||||
setTimeout(() => (permitted = true), delayMillis);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user