Skip to content

Commit

Permalink
wmr- Completed room range delete RA Assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
Mya A Randolph authored and Mya A Randolph committed Nov 9, 2024
1 parent 0e391c6 commit e6671f3
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,19 @@ const RoomRanges = () => {
}
};

const removeAssignment = (index) => {
const rangeId = assignments[index].Range_ID;
http
.del(`Housing/assignment/${rangeId}`)
.then(() => {
assignmentList();
})
.catch((error) => {
console.error('Error removing room range:', error);
window.alert('Error removing room range: ' + error);
});
};

// Post request to API endpoint "Housing/assign-ra" which assigns
// the user selected RA to the user selected room range
const assignPersonToRange = () => {
Expand Down Expand Up @@ -253,9 +266,7 @@ const RoomRanges = () => {
<ListItem key={index}>
{assignment.Fname} {assignment.Lname}: {assignment.Hall_Name}{' '}
{assignment.Room_Start} - {assignment.Room_End}
{/*<Button onClick={() => removeAssignment(index)}>*/}
{/* Remove*/}
{/*</Button>*/}
<Button onClick={() => removeAssignment(index)}>Remove</Button>
</ListItem>
);
})
Expand Down

0 comments on commit e6671f3

Please sign in to comment.