As a user, when I am on the mission view of the website, there should be some way to delete the entire mission
AC
WHEN the page loads I should see a mission and on that mission board there should be a delete button.
THEN click on that delete button
AND the entire mission deletes
DEV NOTES
•Inside the mission folder on the mission.js file
import the missionComponent file that contains the mission domString
import missionComponent from './missionComponent';
•add this icon on the mission domString in the missionComponent with an Id of mission-delete-btn
<i class="fas fa-times-circle"></i>
•create a delete function that will delete the entire mission. call it
USER STORY
As a user, when I am on the mission view of the website, there should be some way to delete the entire mission
AC
WHEN the page loads I should see a mission and on that mission board there should be a delete button. THEN click on that delete button AND the entire mission deletes
DEV NOTES
•Inside the mission folder on the mission.js file import the
missionComponent
file that contains the mission domStringimport missionComponent from './missionComponent';
•add this icon on the mission domString in the missionComponent with an Id of mission-delete-btn<i class="fas fa-times-circle"></i>
•create a delete function that will delete the entire mission. call it
missionDelete
const missionDelete = (e) => { const selectedMissionId = e.target.closest('.user-card').id; missionData.missionDelete (selectedMissionId ) .then(() => { // eslint-disable-next-line no-use-before-define printMission(); }) // eslint-disable-next-line no-console .catch((err) => console.err('cannot remove mission', err)); };
•create a click event for the function in the mission.js file
$('body').on('click', '.mission-delete-btn', missionDelete);
inside the mission authData.js add
missions.clickEvents();
•to the if statement
inside the missionData.js file add an axios call
const deleteMission = (missionId) => axios.delete(
${baseUrl}/mission/${missionId}.json);