frontend: run prettier

This commit is contained in:
ycdesu 2022-06-14 15:33:22 +08:00
parent 258675b93a
commit 19dfd6d219
3 changed files with 25 additions and 28 deletions

View File

@ -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) {

View File

@ -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 }) {

View File

@ -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);
}
}
};
}