nss-evening-cohort-11 / nutshell-ewoks-droids

Star Destroyer
0 stars 2 forks source link

Delete Enemy Mission Target #121

Open kenymc1 opened 4 years ago

kenymc1 commented 4 years ago

USER STORY

As a user, when I am on the mission view of the website, there should be some way to delete the mission enemy

AC

WHEN the page loads I should see a mission and on that mission board there should be a way to delete mission enemy with a button. THEN click on that enemy delete button AND then the enemy 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-enemy-delete-btn

<i class="fas fa-times-circle"></i>

•create a delete function that will delete sectors. call it

missionEnemyDelete

const missionEnemyDelete = (e) => { const selectedMissionEnemyId = e.target.closest('.user-card').id; missionData.missionEnemyDelete (selectedMissionEnemyId ) .then(() => { // eslint-disable-next-line no-use-before-define printMission(); }) // eslint-disable-next-line no-console .catch((err) => console.err('cannot remove mission enemy', err)); };

•create a click event for the function in the mission.js file

$('body').on('click', '#mission-enemy-delete-btn ', missionEnemyDelete);

inside the mission authData.js add

missions.clickEvents();

•to the if statement

inside the missionData.js file add an axios call

const deleteMissionEnemy = (missionSectorId) => axios.delete(${baseUrl}/missionEnemy/${missionSectorId}.json);