As a user, when I am on the mission view of the website, there should be some way to delete the mission sector
AC
WHEN the page loads I should see a mission and on that mission board there should be able to delete mission sectors with a button.
THEN click on that sector delete button
AND then the sector 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-sector-delete-btn
<i class="fas fa-times-circle"></i>
•create a delete function that will delete sectors. 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 mission sector
AC
WHEN the page loads I should see a mission and on that mission board there should be able to delete mission sectors with a button. THEN click on that sector delete button AND then the sector 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 ofmission-sector-delete-btn
<i class="fas fa-times-circle"></i>
•create a delete function that will delete sectors. call it
missionSectorDelete
const missionSectorDelete = (e) => { const selectedMissionSectorId = e.target.closest('.user-card').id; missionData.missionSectorDelete (selectedMissionSectorsId ) .then(() => { // eslint-disable-next-line no-use-before-define printMission(); }) // eslint-disable-next-line no-console .catch((err) => console.err('cannot remove mission sector', err)); };
•create a click event for the function in the mission.js file
$('body').on('click', '.mission-sector-delete-btn ', missionSectorDelete);
inside the mission authData.js add
missions.clickEvents();
•to the if statement
inside the missionData.js file add an axios call
const deleteMissionSectors = (missionSectorId) => axios.delete(
${baseUrl}/missionSectors/${missionSectorId}.json);