Command Palette

Search for a command to run...

Hectal
Phase 8: Tools and Human Approval
AI Frontend · Exercise 3 of 5 PreviousNext
Advanced

Ask Before Cancelling

The route's cancelOrder tool needs approval, and the server builds the request text. Write the approval card.

When a part is in approval-requested, show a div#approval with the request text (part.approval.requestReason) in #what, a button #yes (Yes, cancel it) that approves and a button #no (No, keep it) that denies. Both buttons must lock after the first press. Add sendAutomaticallyWhen so the answer is sent. The final answer appears in #answer.

What Check tests

  1. Before the question, there is no #approval
  2. After the question, #what shows the server's request text and the tool has not run
  3. #yes and #no exist with the right words
  4. After pressing #yes twice, the order is cancelled once and #answer says so
  5. The card is gone after the answer

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.