function displayNotes() {
  getAllNotes().then(data => {
    jQuery('#note').val('');
    const noteList = [];
    if (Array.isArray(data) && data.length && data[0].notes.length) {
      data.forEach(node => {
        node.notes.forEach(note => {
          noteList.push(note);
        });
      });
      jQuery('#notesList').html(`<p>${noteList.join('</p><p>')}</p>`);
    } else {
      jQuery('#notesList').html('<p>No notes yet!</p>');
    }
  }, error => {
    console.log('failed to get all the notes with error');
    console.log(error);
    notify('danger', 'Failed to load the notes');
  });
}
/**
 * This method fetches all the notes and renders in the notes container element.
 */
This method fetches all the notes and renders in the notes container element.
This method fetches all the notes and renders in the notes container element .
function displayNotes() {
  getAllNotes().then(data => {
    jQuery('#note').val('');
    const noteList = [];
    if (Array.isArray(data) && data.length && data[0].notes.length) {
      data.forEach(node => {
        node.notes.forEach(note => {
          noteList.push(note);
        });
      });
      jQuery('#notesList').html(`<p>${noteList.join('</p><p>')}</p>`);
    } else {
      jQuery('#notesList').html('<p>No notes yet!</p>');
    }
  }, error => {
    console.log('failed to get all the notes with error');
    console.log(error);
    notify('danger', 'Failed to load the notes');
  });
}
function displayNotes ( ) { getAllNotes ( ) . then ( data => { jQuery ( '#note' ) . val ( '' ) ; const noteList = [ ] ; if ( Array . isArray ( data ) && data . length && data [ 0 ] . notes . length ) { data . forEach ( node => { node . notes . forEach ( note => { noteList . push ( note ) ; } ) ; } ) ; jQuery ( '#notesList' ) . html ( ` ${ noteList . join ( '</p><p>' ) } ` ) ; } else { jQuery ( '#notesList' ) . html ( '<p>No notes yet!</p>' ) ; } } , error => { console . log ( 'failed to get all the notes with error' ) ; console . log ( error ) ; notify ( 'danger' , 'Failed to load the notes' ) ; } ) ; }
This method fetches all the notes and renders in the notes container element.
This method fetches all the notes and renders in the notes container element .