Files
memos/web/src/services/editorStateService.ts
2022-05-22 11:01:20 +08:00

27 lines
568 B
TypeScript

import store from "../store";
import { setEditMemoId, setMarkMemoId } from "../store/modules/editor";
const editorStateService = {
getState: () => {
return store.getState().editor;
},
setEditMemoWithId: (editMemoId: MemoId) => {
store.dispatch(setEditMemoId(editMemoId));
},
clearEditMemo: () => {
store.dispatch(setEditMemoId());
},
setMarkMemoWithId: (markMemoId: MemoId) => {
store.dispatch(setMarkMemoId(markMemoId));
},
clearMarkMemo: () => {
store.dispatch(setMarkMemoId());
},
};
export default editorStateService;