mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 11:47:56 +01:00
Redux store is not a singleton anymore (-> bug fixes)
This commit is contained in:
@@ -1,23 +1,53 @@
|
||||
import * as React from 'react';
|
||||
import { Provider } from 'react-redux';
|
||||
|
||||
import store from '../../stores';
|
||||
import createStoreHelper from '../../helpers/createStore';
|
||||
|
||||
import Post from '../../containers/Post';
|
||||
|
||||
import IPostStatus from '../../interfaces/IPostStatus';
|
||||
|
||||
import '../../stylesheets/components/Post.scss';
|
||||
|
||||
const PostRoot = ({ postId, postStatuses, isLoggedIn, isPowerUser, authenticityToken }) => (
|
||||
<Provider store={store}>
|
||||
<Post
|
||||
postId={postId}
|
||||
postStatuses={postStatuses}
|
||||
interface Props {
|
||||
postId: number;
|
||||
postStatuses: Array<IPostStatus>;
|
||||
isLoggedIn: boolean;
|
||||
isPowerUser: boolean;
|
||||
authenticityToken: string;
|
||||
}
|
||||
|
||||
isLoggedIn={isLoggedIn}
|
||||
isPowerUser={isPowerUser}
|
||||
authenticityToken={authenticityToken}
|
||||
/>
|
||||
</Provider>
|
||||
);
|
||||
class PostRoot extends React.Component<Props> {
|
||||
store: any;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.store = createStoreHelper();
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
postId,
|
||||
postStatuses,
|
||||
isLoggedIn,
|
||||
isPowerUser,
|
||||
authenticityToken
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<Provider store={this.store}>
|
||||
<Post
|
||||
postId={postId}
|
||||
postStatuses={postStatuses}
|
||||
|
||||
isLoggedIn={isLoggedIn}
|
||||
isPowerUser={isPowerUser}
|
||||
authenticityToken={authenticityToken}
|
||||
/>
|
||||
</Provider>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default PostRoot;
|
||||
Reference in New Issue
Block a user