prolog-point-of-sale/views/cart.pl

12 lines
352 B
Perl
Raw Normal View History

2019-11-03 01:05:33 +00:00
:- http_handler(root(cart/add/ProductName), cart_add(ProductName), []).
% GET /cart/add/ProductName
2019-11-03 23:41:08 +00:00
cart_add(ProductName, Request) :-
\+ product(ProductName, _), !,
http_redirect(see_other, root(.), Request).
2019-11-03 01:05:33 +00:00
cart_add(ProductName, Request) :-
2019-11-04 23:05:56 +00:00
http_session_assert(cart_entry(ProductName)),
2019-11-03 01:05:33 +00:00
http_redirect(see_other, root(.), Request).