title: Angular/Http "put" method only returning undefined?
body: <p>I've been trying to make a very basic app pulling user information from a .json file and &quot;logging them in&quot;, and have a json storing whether a user is logged into the app and their user ID. I'm stuck on a method which would take the given email and password, match them to an entry in the users json, then update the login json with the new information (login true, and user ID.) This is what I have so far in the method:</p>
  <pre><code>setUserLogIn(email, password):any{
  if (this.users){
    this.users.forEach(foundUser =&gt; {
    if (foundUser.email === email &amp;&amp; foundUser.password === password){
      this.currentUser=foundUser;
  
      let login:Login = {&quot;id&quot;: 1, &quot;loginStatus&quot;:true, &quot;userId&quot;:foundUser.id}
      return this.httpService.put&lt;Observable&lt;any&gt;&gt;('http://localhost:7800/loginCheck/1', login)
        .pipe(map((log:Observable&lt;Login&gt;) =&gt;{
          console.log(log) //this isn't reached, never prints in console
          if (log !== undefined){
            return true;
          }
          return false;
        }))
      }
      if (this.currentUser != null){
        FetchUserService.isLoggedIn = true;
      } else{
        FetchUserService.isLoggedIn = false;
      }
  })
  </code></pre>
  <p>}
  }</p>
  <p>From my previous tests I know everything else in the method works correctly, just the put only returns undefined. I am subscribing to the method in the controller:</p>
  <pre><code>this.fetchUserService.setUserLogIn(this.userEmail, this.userPassword).subscribe(data =&gt; {
    console.log(data);
  })
  </code></pre>
  <p>This method of subscription returns an error. I also tried subscribing in the service itself, like:</p>
  <pre><code>return this.httpService.put&lt;Observable&lt;any&gt;&gt;('http://localhost:7800/loginCheck/1', login)
        .pipe(map((log:Observable&lt;Login&gt;) =&gt;{
          console.log(log)
          if (log !== undefined){
            log.subscribe(data =&gt; {
              return data
            })
  </code></pre>
  <p>Taking this into the component and logging the result also just returns undefined.</p>
  <p>Any suggestions? I have no idea what I'm doing wrong, after searching put methods for the past few hours I can't see any differences in what I have there. Any help is greatly appreciated!</p>