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

On loading new scene, RestClient gets stuck. #179

Closed
maifeeulasad opened this issue Jun 2, 2021 · 7 comments · Fixed by #190
Closed

On loading new scene, RestClient gets stuck. #179

maifeeulasad opened this issue Jun 2, 2021 · 7 comments · Fixed by #190

Comments

@maifeeulasad
Copy link
Collaborator

I have this code in my project, this is LoginScene :

RestClient.Post<BaseDto>(loginRoute, loginCredential).Then(res => {
            BaseDto baseDto = res;
            if(baseDto!=null){
                SceneManager.LoadScene("HomeScene");
            }else{
                Modal
                    .MessageBox(
                        "Login failed",
                        "Please provide correct credentials",
                        null);
            }
        })

In the HomeScene, when I try to do any API call :

        Debug.Log("1");
        RestClient.Get<long>(playerRoute).Then(res => {
            Debug.Log("response");
        }).Catch(err => {
            Debug.Log("err");
        });
        Debug.Log("2");

It's just stuck. The only thing I get in my console is 1

#8 still exists.

And there is a Don't destroy on load then some static coroutine component inside it.

@maifeeulasad
Copy link
Collaborator Author

Even tried this :

        var loginRequest = new RequestHelper { 
            Uri = loginRoute,
            Body = loginCredential
        };

        RestClient.Post<BaseDto>(loginRequest).Then(res => {
            BaseDto baseDto = res;
            if(baseDto!=null){
                Defaults.jwt = baseDto.message;
                loginRequest.Abort();
                StartHome();
            }
            ...
        });

Even aborting the request doesn't work

@jdnichollsc
Copy link
Member

I'm not working with Unity right now but any pull request is welcome! <3

@maifeeulasad
Copy link
Collaborator Author

I've resolved the problem on my project. When my project is done. I'll discuss it with you all and submit a PR if assigned.

Thanks.

@jdnichollsc
Copy link
Member

Awesome, thanks mate for letting me know! 👍

@jdnichollsc
Copy link
Member

Any pull request is welcome, thanks for reporting this issue! <3

@teo-sk
Copy link

teo-sk commented Oct 18, 2021

I've resolved the problem on my project. When my project is done. I'll discuss it with you all and submit a PR if assigned.

Thanks.

@maifeeulasad Could you please elaborate on how you fixed this issue in your project? Thanks!

@maifeeulasad
Copy link
Collaborator Author

@teo-sk hello, just created a pull, here: https://github.com/maifeeulasad/RestClient/tree/stuck-fix

Hope it helps you. Thanks.

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

Successfully merging a pull request may close this issue.

3 participants