Created
January 18, 2018 14:31
-
-
Save matt-mcalister/ec85f9f1cdd9cb965ced46c5d4095c95 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetchFromBackEnd(){ | |
fetch("http://localhost:3000/api/v1/notes") | |
.then(response => response.json()) | |
.then(notes => { | |
// render sidebar notes | |
for (const note of notes) { | |
let newNote = new Note({title: note.title, body: note.body, id: note.id}); | |
newNote.createSidebarDiv() | |
} | |
// sidebar eventlistener (show note) | |
this.sideBar.addEventListener('click', this.handleShowFullNote.bind(this)); | |
// new note button listener | |
this.newNote.addEventListener('click', this.handleNewNote.bind(this)); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment