Advanced
Only the Signed-In User's Orders
The route /api/order returns any order for any id. The signed-in user is asha (the constant SESSION_USER). Change the route so it returns the order only when its owner is the session user, and { found: false } otherwise, with status 200 in both cases.
The buttons #own (asks for ORD-1042) and #other (asks for ORD-2001) show the answer in #result: found: Masala chai 250 g or found: false. The page code is done; change only the route.
What Check tests
- Your own order is found
- Someone else's order shows
found: false - The route uses
SESSION_USER
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.