msToMinAndSec
parent
9780b42cd1
commit
8c6c76b329
|
@ -5,6 +5,7 @@ import { PowerSettingsNew } from "@material-ui/icons";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useToast } from "../../../hooks";
|
import { useToast } from "../../../hooks";
|
||||||
import * as api from "../api";
|
import * as api from "../api";
|
||||||
|
import { msToMinAndSec } from "../../../utils/time";
|
||||||
|
|
||||||
const initialState = { on: false };
|
const initialState = { on: false };
|
||||||
const defaultPingInterval = 1200000; //20 minutes
|
const defaultPingInterval = 1200000; //20 minutes
|
||||||
|
@ -43,7 +44,11 @@ const WakeComponent = ({ machine, addLog }) => {
|
||||||
success(result.status);
|
success(result.status);
|
||||||
|
|
||||||
//retrigger
|
//retrigger
|
||||||
log(`Periodic ping will be re-triggered in ${startingTime} ms.`);
|
log(
|
||||||
|
`Periodic ping will be re-triggered in ${startingTime} ms [${msToMinAndSec(
|
||||||
|
startingTime
|
||||||
|
)}]`
|
||||||
|
);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setTrigger(prev => !prev);
|
setTrigger(prev => !prev);
|
||||||
}, startingTime);
|
}, startingTime);
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
function msToMinAndSec(ms) {
|
||||||
|
const minutes = Math.floor(ms / 60000);
|
||||||
|
const seconds = ((ms % 60000) / 1000).toFixed(0);
|
||||||
|
|
||||||
|
return `${minutes}m ${seconds}s`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { msToMinAndSec };
|
Loading…
Reference in New Issue