tidying up

This commit is contained in:
Gala
2022-12-15 16:45:49 +01:00
parent 7d001965ec
commit 2470c8b9b5
@@ -1,17 +1,7 @@
import React, { useContext, useEffect, useState } from 'react';
import { useForm } from 'react-hook-form';
import { yupResolver } from '@hookform/resolvers/yup';
import {
Button,
Divider,
Typography,
TextField,
InputAdornment,
Grid,
CircularProgress,
Box,
FormHelperText,
} from '@mui/material';
import { Button, Divider, Typography, TextField, InputAdornment, Grid, Box, FormHelperText } from '@mui/material';
import { useTheme } from '@mui/material/styles';
import { CurrencyDenom, MixNodeCostParams } from '@nymproject/types';
import { CurrencyFormField } from '@nymproject/react/currency/CurrencyFormField';
@@ -34,7 +24,6 @@ import { AppContext } from 'src/context';
import { useGetFee } from 'src/hooks/useGetFee';
import { ConfirmTx } from 'src/components/ConfirmTX';
import { LoadingModal } from 'src/components/Modals/LoadingModal';
import { getIntervalAsDate } from 'src/utils';
export const ParametersSettings = ({ bondedNode }: { bondedNode: TBondedMixnode }): JSX.Element => {
const [openConfirmationModal, setOpenConfirmationModal] = useState<boolean>(false);
@@ -62,9 +51,13 @@ export const ParametersSettings = ({ bondedNode }: { bondedNode: TBondedMixnode
defaultValues,
});
const getCurrentInterval = async () => {
const { nextEpoch } = await getIntervalAsDate();
setNextEpoch(nextEpoch);
const getNextInterval = async () => {
try {
const { nextInterval } = await getIntervalAsDate();
setIntervalTime(nextInterval);
} catch {
console.log('cant retrieve next interval');
}
};
const getPendingEvents = async () => {
@@ -88,7 +81,7 @@ export const ParametersSettings = ({ bondedNode }: { bondedNode: TBondedMixnode
};
useEffect(() => {
getCurrentInterval();
getNextInterval();
getPendingEvents();
}, []);