import React, { useEffect } from 'react';
import { StoreProvider } from 'easy-peasy';
import store from './store';
import AuthenticationStoreContainer from '../authentication/AuthenticationStoreContainer';
import { loadPlacementStore } from '../placements/placements.store';

interface Props {
	children: any;
}

function StoreProviderContainer({ children }: Props) {
	useEffect(() => {
		loadPlacementStore(store);
	}, []);

	return (
		<StoreProvider store={store}>
			<AuthenticationStoreContainer>{children}</AuthenticationStoreContainer>
		</StoreProvider>
	);
}

export default StoreProviderContainer;
