2020-01-16 02:09:53 +05:30
|
|
|
import React, { ComponentType, useEffect, useState } from 'react';
|
|
|
|
|
|
|
|
import logger from 'app/services/logger/logger';
|
|
|
|
|
|
|
|
import BSoD from './BSoD';
|
|
|
|
|
|
|
|
const BSoDContainer: ComponentType = () => {
|
2020-05-24 04:38:24 +05:30
|
|
|
const [lastEventId, setLastEventId] = useState<string>();
|
|
|
|
useEffect(() => {
|
|
|
|
const timer = setInterval(() => {
|
|
|
|
// eslint-disable-next-line no-shadow
|
|
|
|
const lastEventId = logger.getLastEventId();
|
2020-01-16 02:09:53 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
if (!lastEventId) {
|
|
|
|
return;
|
|
|
|
}
|
2020-01-16 02:09:53 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
clearInterval(timer);
|
|
|
|
setLastEventId(lastEventId);
|
|
|
|
}, 500);
|
2020-01-16 02:09:53 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
// Don't care about interval cleanup because there is no way from
|
|
|
|
// BSoD state and page can be only reloaded
|
|
|
|
}, []);
|
2020-01-16 02:09:53 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
return <BSoD lastEventId={lastEventId} />;
|
2020-01-16 02:09:53 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
export default BSoDContainer;
|