updateDataSource(city) {
    // GET mock request using fetch with async/await
    const requestOptions = {
      method: "GET",
      headers: {
        Accept: "application/json",
        "Content-Type": "application/json",
      },
    };
    fetch(
      `${this.state.apiEndpint}/api/v0/event/recent/${city}`,
      requestOptions
    )
      .then((response) => response.json())
      .then((json) => {
        this.setState({ data: json, loaded: true });
        console.log("loaded initial data from backend");
      });
  }
// loads a fresh copy of all event data from server
loads a fresh copy of all event data from server
loads a fresh copy of all event data from server
updateDataSource(city) {
    const requestOptions = {
      method: "GET",
      headers: {
        Accept: "application/json",
        "Content-Type": "application/json",
      },
    };
    fetch(
      `${this.state.apiEndpint}/api/v0/event/recent/${city}`,
      requestOptions
    )
      .then((response) => response.json())
      .then((json) => {
        this.setState({ data: json, loaded: true });
        console.log("loaded initial data from backend");
      });
  }
updateDataSource ( city ) { const requestOptions = { method : "GET" , headers : { Accept : "application/json" , "Content-Type" : "application/json" , } , } ; fetch ( ` ${ this . state . apiEndpint } ${ city } ` , requestOptions ) . then ( ( response ) => response . json ( ) ) . then ( ( json ) => { this . setState ( { data : json , loaded : true } ) ; console . log ( "loaded initial data from backend" ) ; } ) ; }
loads a fresh copy of all event data from server
loads a fresh copy of all event data from server
// GET mock request using fetch with async/await