Closed christopherjohnson1 closed 4 years ago
as a user I should be able to edit personnel
WHEN the user logs in THEN there should be an edit button on all personnel cards AND you should be able to update any personnel item with a modal form
<div>
id="edit-personnel-modal"
id="add-new-personnel-modal"
buildPersonnelCards
class="edit-personnel-btn"
editPersonnelForm
personnelData
utils
id="submit-personnel-edit"
editPersonnelItem
personnel.js
personnelData.js
updatePersonnel
axios.put(personnelId, editedPersonnelItem)
editedPersonnelItem
key:value
.then()
buildAllPersonnel
.catch()
User Story
as a user I should be able to edit personnel
AC
WHEN the user logs in THEN there should be an edit button on all personnel cards AND you should be able to update any personnel item with a modal form
Dev Notes
<div>
withid="edit-personnel-modal"
at the top of index.html, underid="add-new-personnel-modal"
and above everything elsebuildPersonnelCards
functionclass="edit-personnel-btn"
editPersonnelForm
functioneditPersonnelForm
editPersonnelForm
functionpersonnelData
utils
id="submit-personnel-edit"
editPersonnelItem
which lives inpersonnel.js
personnelData.js
make a new function calledupdatePersonnel
that usesaxios.put(personnelId, editedPersonnelItem)
methodeditedPersonnelItem
that has thekey:value
pairs the same as the original seed data objectsupdatePersonnel
ineditPersonnelItem
.then()
callsbuildAllPersonnel
.catch()
should console.error a comment and the error