accounts-frontend/packages/app/components/ui/bsod/dispatchBsod.tsx

40 lines
923 B
TypeScript
Raw Normal View History

import React from 'react';
import ReactDOM from 'react-dom';
import { ContextProvider } from 'app/shell';
import { Store } from 'app/types';
import { History } from 'history';
import { bsod } from './actions';
import BSoDContainer from './BSoDContainer';
let injectedStore: Store;
let injectedHistory: History<any>;
let onBsod: undefined | (() => void);
2020-05-24 04:38:24 +05:30
export default function dispatchBsod(store = injectedStore, history = injectedHistory) {
store.dispatch(bsod());
onBsod && onBsod();
2020-05-24 04:38:24 +05:30
ReactDOM.render(
<ContextProvider store={store} history={history}>
<BSoDContainer />
</ContextProvider>,
document.getElementById('app'),
);
}
export function inject({
2020-05-24 04:38:24 +05:30
store,
history,
stopLoading,
}: {
2020-05-24 04:38:24 +05:30
store: Store;
history: History<any>;
stopLoading: () => void;
}) {
2020-05-24 04:38:24 +05:30
injectedStore = store;
injectedHistory = history;
onBsod = stopLoading;
}