mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-13 00:39:02 +05:30
30 lines
741 B
TypeScript
30 lines
741 B
TypeScript
|
import React, { ComponentType, useEffect, useState } from 'react';
|
||
|
|
||
|
import logger from 'app/services/logger/logger';
|
||
|
|
||
|
import BSoD from './BSoD';
|
||
|
|
||
|
const BSoDContainer: ComponentType = () => {
|
||
|
const [lastEventId, setLastEventId] = useState<string>();
|
||
|
useEffect(() => {
|
||
|
const timer = setInterval(() => {
|
||
|
// eslint-disable-next-line no-shadow
|
||
|
const lastEventId = logger.getLastEventId();
|
||
|
|
||
|
if (!lastEventId) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
clearInterval(timer);
|
||
|
setLastEventId(lastEventId);
|
||
|
}, 500);
|
||
|
|
||
|
// Don't care about interval cleanup because there is no way from
|
||
|
// BSoD state and page can be only reloaded
|
||
|
}, []);
|
||
|
|
||
|
return <BSoD lastEventId={lastEventId} />;
|
||
|
};
|
||
|
|
||
|
export default BSoDContainer;
|