diff --git a/src/stores/Auth.js b/src/stores/Auth.js new file mode 100644 index 0000000..3884377 --- /dev/null +++ b/src/stores/Auth.js @@ -0,0 +1,11 @@ +import { makeAutoObservable } from "mobx"; + +class Auth { + + constructor(root) { + makeAutoObservable(this, { rootStore: false }); + this.root = root; + } +} + +export default Auth; \ No newline at end of file diff --git a/src/stores/Root.js b/src/stores/Root.js index f369e8f..fb17968 100644 --- a/src/stores/Root.js +++ b/src/stores/Root.js @@ -1,9 +1,11 @@ import { makeAutoObservable } from "mobx"; import Plan from "./Plan"; +import Auth from "./Auth"; class Root { constructor() { this.plan = new Plan(this); + this.auth = new Auth(this); makeAutoObservable(this); } } diff --git a/src/views/Plan.jsx b/src/views/Plan.jsx index c314b3f..f1e8cf0 100644 --- a/src/views/Plan.jsx +++ b/src/views/Plan.jsx @@ -79,8 +79,7 @@ const data = [ function Plan() { const {planId} = useParams(); - const store = useStore(); - const planStore = store.plan; + const {plan} = useStore(); useEffect(() => { console.info('planId: ' + planId); @@ -94,8 +93,8 @@ function Plan() {