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

middleware with server call is not blocker #3

Open
Luigidefra opened this issue Nov 30, 2020 · 0 comments
Open

middleware with server call is not blocker #3

Luigidefra opened this issue Nov 30, 2020 · 0 comments

Comments

@Luigidefra
Copy link

Luigidefra commented Nov 30, 2020

Hi, I don't know if I am wrong something or there is a bug in the code but if a middleware has a call inside it that decides whether the request of the component passes or not, the middleware does not wait for the response of the call, it temporarily displays the component up a that the call was not answered and then blocks the component and redirects to the page specified in the middleware

    DataService.setAuthentication();

    DataService.get(config_app.base_url+'user_verified')
        .then(response => {
            if(response.data.results == true){
                return next();
            }
        }).catch((error) => {
           if(error.response.status == 403){
               return router.push({name: 'must-be-verified'});
           }
    }).finally(() => {
        return router.push({name: 'home'});
    })

With this function I check if a user has verified his mail, before the function goes into the catch, however, it sends me inside my management system, when the answer arrives and it triggers catch, he will go to
return router.push ({name: 'must-be-verified'});
and will update the page with this new route

@Luigidefra Luigidefra changed the title middleware with server call is not blocer middleware with server call is not blocker Nov 30, 2020
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

1 participant