|
|
@ -1,10 +1,11 @@ |
|
|
|
import { createStore, Store } from "redux"; |
|
|
|
import { createStore, Store } from "redux"; |
|
|
|
import { createContext, Context, useContext } from "react"; |
|
|
|
import { createContext, Context } from "react"; |
|
|
|
import { reducer, Action } from "./reducers"; |
|
|
|
import { reducer, Action } from "./reducers"; |
|
|
|
import { IEditorState } from "./type"; |
|
|
|
import { IEditorState } from "./type"; |
|
|
|
import { EditorAction } from "./actions"; |
|
|
|
import { EditorAction } from "./actions"; |
|
|
|
|
|
|
|
|
|
|
|
export * from "./type"; |
|
|
|
export * from "./type"; |
|
|
|
|
|
|
|
export * from "./selectors"; |
|
|
|
|
|
|
|
|
|
|
|
type IStore = Store<IEditorState, Action>; |
|
|
|
type IStore = Store<IEditorState, Action>; |
|
|
|
const store: IStore = createStore(reducer); |
|
|
|
const store: IStore = createStore(reducer); |
|
|
@ -13,29 +14,8 @@ const store: IStore = createStore(reducer); |
|
|
|
|
|
|
|
|
|
|
|
export { store }; |
|
|
|
export { store }; |
|
|
|
|
|
|
|
|
|
|
|
// export class Store {
|
|
|
|
|
|
|
|
// // editorState: IEditorState;
|
|
|
|
|
|
|
|
// // mapState: IMapState;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// constructor() {
|
|
|
|
|
|
|
|
// this.editorState = {};
|
|
|
|
|
|
|
|
// this.mapState = {
|
|
|
|
|
|
|
|
// polygons: [],
|
|
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// addPolygon() {
|
|
|
|
|
|
|
|
// //
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const editorAction = new EditorAction(); |
|
|
|
export const editorAction = new EditorAction(); |
|
|
|
|
|
|
|
|
|
|
|
export const StoreContext = createContext<IStore | null>( |
|
|
|
export const StoreContext = createContext<IStore | null>( |
|
|
|
null |
|
|
|
null |
|
|
|
) as Context<IStore>; |
|
|
|
) as Context<IStore>; |
|
|
|
|
|
|
|
|
|
|
|
// export const useStore = () => {
|
|
|
|
|
|
|
|
// const store = useReduxContext(StoreContext);
|
|
|
|
|
|
|
|
// return store;
|
|
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|