Closed cjgochanour closed 2 years ago
Tested functionality, it works on both the list page and the individual employee page. It all checks out for me!
Your modified features in file work as designed. Wherein when employee fire
button is clicked, employee card is removed and page is reloaded with new updated employee list.
Nice work!!!
Changes Made
Modified file
Employee.js
to includeremoveEmployeeWithReload()
. This function deletes the given employee and sets the state ofemps
inEmployee.js
with the fresh list of employees.Modified file
Employee.js
to includeremoveEmployeeWithRedirect()
. This function deletes the given employee when in employee's detailed view and redirects the user back to the list of all employees.Modified file
Employee.js
to include a ternary statement that determines whether to runremoveEmployeeWithReload()
orremoveEmployeeWithRedirect()
depending on which view the user is observing.Modified file
Employee.js
to include a ternary statement that determines whether to show the fire button depending on whether the currentUser is an employee or a customer.Modified file
EmployeeList.js
to passsetEmps
prop to<Employee>
function for setting theemps
array after database change. Steps to Review
Checkout this branch locally.
Open a new Terminal tab (⌘T or Ctrl+Shift+T) and navigate to the server directory. Host the file locally with
npm start
and usejson-server
to host your version of the API.Test app functionality.
View code file.