Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token验证问题 #78

Open
OkamiyGit opened this issue Jul 30, 2020 · 3 comments
Open

Token验证问题 #78

OkamiyGit opened this issue Jul 30, 2020 · 3 comments

Comments

@OkamiyGit
Copy link

OkamiyGit commented Jul 30, 2020

项目写了一半,后台换人了,现在,要在header里面进行accesstoken验证,返回202视为验证过期,清除登录信息,跳转登录界面,,,,,求大佬指点怎么添加这个处理,着急

@MisterBowie
Copy link

再ApiSubscriber中处理

@MisterBowie
Copy link

也可以在 XApi 中
/**
* 异常处理变换
*
* @return
*/
public static FlowableTransformer<T, T> getApiTransformer() {

    return new FlowableTransformer<T, T>() {
        @Override
        public Publisher<T> apply(Flowable<T> upstream) {
            return upstream.flatMap(new Function<T, Publisher<T>>() {
                @Override
                public Publisher<T> apply(T model) throws Exception {

                    if (model == null || model.isNull()) {
                        return Flowable.error(new NetError(model.getErrorMsg(), NetError.NoDataError));
                    } else if (model.isAuthError()) {
                        return Flowable.error(new NetError(model.getErrorMsg(), NetError.AuthError));
                    } else if (model.isBizError()) {
                        return Flowable.error(new NetError(model.getErrorMsg(), NetError.BusinessError));
                    } else {
                        return Flowable.just(model);
                    }
                }
            });
        }
    };
}

@OkamiyGit
Copy link
Author

大佬,我是新手,不怎么会,qq542839122,有空帮我处理一下吧,,,就卡这里了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants