<commit_before>import React from 'react';
import Axios from 'axios';
import OpenWeatherMap from '../openWeatherMap';

export default class Title extends React.Component {

  render() {
    return (
      <div className="container-fluid">
        <div className="row">
          <div className="col-md-12">
{this.currentWeather.main.temp}
          </div>
        </div>
      </div>
    );
  }


  componentDidMount = () => {
   this.getCurrentWeatherData();
  }

  state = {
    currentWeather: {}
  }

  createUrlLatLong(){
 // url: 'http://api.openweathermap.org/data/2.5/forecast/city?' //'http://api.openweathermap.org/data/2.5/forecast/city?id={this.cityId}&APPID={this.key}'
  return OpenWeatherMap.urlLatLong + 'lat=' + OpenWeatherMap.baseLattitude  + '&lon='+ OpenWeatherMap.baseLongitude + '&units=' + OpenWeatherMap.units + '&APPID='+ OpenWeatherMap.key;
  }

  createUrlCityId(){
  	 // url: 'http://api.openweathermap.org/data/2.5/forecast/city?' //'http://api.openweathermap.org/data/2.5/forecast/city?id={this.cityId}&APPID={this.key}'
	return OpenWeatherMap.urlCityId + 'id=' + OpenWeatherMap.cityId + '&units=' + OpenWeatherMap.units + '&APPID='+ OpenWeatherMap.key;
  }

  createIconUrl(icon){
  	return OpenWeatherMap.iconUrl + icon + '.png';
  }

  getCurrentWeatherData(){
   Axios.get(this.createUrlLatLong(), {
      params: {
      },
      headers: {
      }
    })
    .then((response) => {
      this.setState({
         currentWeather: response.data
      });
      console.log(response.data);
    })
    .catch((response) => {
      console.error(response);
    });
  }



};<commit_msg>Weather now updated component when promise is returned.<commit_after>import React from 'react';
import Axios from 'axios';
import OpenWeatherMap from '../openWeatherMap';

export default class Title extends React.Component {

  render() {
    return (
      <div className="container-fluid">
        <div className="row">
          <div className="col-md-12">
          {this.state.currentWeather.main ? this.getWeatherView() : <span> No Temp yet</span>}
          </div>
        </div>
      </div>
    );
  }




  state = {
    currentWeather: {}
  }

  componentDidMount = () => {
   this.getCurrentWeatherData();
  }

  getWeatherView(){
    return <div>
      {this.state.currentWeather.main.temp}
       <img src = {this.createIconUrl(this.state.currentWeather.weather[0].icon)}>
        </img>
      </div>;
  }

  createUrlLatLong(){
 // url: 'http://api.openweathermap.org/data/2.5/forecast/city?' //'http://api.openweathermap.org/data/2.5/forecast/city?id={this.cityId}&APPID={this.key}'
  return OpenWeatherMap.urlLatLong + 'lat=' + OpenWeatherMap.baseLattitude  + '&lon='+ OpenWeatherMap.baseLongitude + '&units=' + OpenWeatherMap.units + '&APPID='+ OpenWeatherMap.key;
  }

  createUrlCityId(){
  	 // url: 'http://api.openweathermap.org/data/2.5/forecast/city?' //'http://api.openweathermap.org/data/2.5/forecast/city?id={this.cityId}&APPID={this.key}'
	return OpenWeatherMap.urlCityId + 'id=' + OpenWeatherMap.cityId + '&units=' + OpenWeatherMap.units + '&APPID='+ OpenWeatherMap.key;
  }

  createIconUrl(icon){
  	return OpenWeatherMap.iconUrl + icon + '.png';
  }

  getCurrentWeatherData(){
   Axios.get(this.createUrlLatLong(), {
      params: {
      },
      headers: {
      }
    })
    .then((response) => {
      this.setState({
         currentWeather: response.data
      });

      return response.data;
    })
    .catch((response) => {
      console.error(response);
    });
  }



};
{'fraction_non_alphanumeric': 0.17072480181200453, 'fraction_numerical': 0.00594563986409966, 'mean_word_length': 2.9830890642615557, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7199726', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1209, 'n_words': 174}