Mobx状态树-商店价值仍然停留在Web浏览器中

时间:2020-05-05 04:35:43

标签: reactjs next.js mobx

Web浏览器登录->访问另一个Web浏览器->已登录另一个Web浏览器。 我该怎么解决?

import { applySnapshot, Instance, SnapshotIn, SnapshotOut, types } from 'mobx-state-tree';

let store: IStore = null as any;

const Store = types
  .model({
    token: types.string,
    isSignin: false,
  })
  .actions(self => {
    const signin = (token: string) => {
      self.isSignin = true,
      self.token = token
    }
    const signout = () => {
      self.isSignin = false,
      self.token = ''
    }
    return { signin, signout };
  });

export type IStore = Instance<typeof Store>;
export type IStoreSnapshotIn = SnapshotIn<typeof Store>;
export type IStoreSnapshotOut = SnapshotOut<typeof Store>;

0 个答案:

没有答案