0

Login Function in my Component File

logIn() {
    this._userServices
        .login(this.signInForm.value)
        .then((result: any) => {
            console.log('result', result);

            // localStorage.setItem('accessToken', result.data.login.token);
            // localStorage.setItem('userId', result.data.login.userId);

            // const redirectURL =
            //     this._activatedRoute.snapshot.queryParamMap.get(
            //         'redirectURL'
            //     ) || '/signed-in-redirect';

            // Navigate to the redirect url
            // this._router.navigateByUrl(redirectURL);
        })
        .catch((err) => {
            console.log(err);
        });
}

My Service File with Login Function Including Query for Apollo GraphQl

 login = (value) => {
    return new Promise((resolve, reject) => {
        this.apollo
            .mutate({
                mutation: this.User_Login,
                variables: {
                    email: value.email,
                    password: value.password,
                },
            })
            
        .subscribe(
            (result) => {
                console.log(result);

                resolve(result);
            },
            (error) => {
                reject(error);
            }
        );
    });
};

This is my GraphQL Query Successfully Tested with Apollo Studio

public User_Login = gql`
    mutation Mutation($email: String, $password: String) {
        login(email: $email, password: $password) {
            token
            userId
        }
    }
`;

Error Message I'm Getting

ApolloError: You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.

I Have Tested the Query from Apollo studio and I Got the Data . I am Getting this Error when I Request through my Angular front End. But I Successfully Connected My Other Services with my Backend there is No Problem with that. But When I Tried to Connect Sign In Feature with My Backend This is the Error I'm Getting. How An I Solve this, I Have No Idea About where is the Error Comes From .

0 Answers0