我应该为 mobx 模型中的 RouterStore 设置哪种类型?

问题描述

我应该为 mobx 模型中的 RouterStore 设置哪种类型?

我想在失败操作后重定向到某个地方,这可能吗?

const ViewerModel = types
    .model({
        routingStore: ?????,})
    .actions((self) => {
        const actions = {
            checkStatus: flow(function* checkStatus() {
                if (!self.isLoaded) {
                    try {
                        const response: AxiosResponse<{
                            studyID?: string;
                            state: QueueState;
                        }> = yield axios.post(Endpoints.CheckQueueState,{ id: self.task });
                        ...
                    } catch ({ message,code }) {
                       self.routingStore.replace('/');
                    }
                }
            }),};

        return actions;
    });

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)