From fe828c9727bc87fb77d8cf889e5f034a02e2e7ee Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Fri, 22 Sep 2023 20:23:19 -0400 Subject: [PATCH] Move dumpup out of the way since it's more of an example. --- api/authcheck.js | 8 ++++++-- commands/{ => examples}/dumpup.js | 0 2 files changed, 6 insertions(+), 2 deletions(-) rename commands/{ => examples}/dumpup.js (100%) diff --git a/api/authcheck.js b/api/authcheck.js index d67d0e6..2736259 100644 --- a/api/authcheck.js +++ b/api/authcheck.js @@ -3,9 +3,13 @@ import { API } from "../lib/api.js"; export const get = async (req, res) => { const api = new API(req, res); + const { product_id } = req.query; - // the user should be authenticated already - const [paid, payment] = await Payment.paid(api.user); + // the user should be authenticated already, so this + // will confirm either that the person bought this + // specific product, or bought any product when product_id=undefined + const paid = await Payment.paid(api.user, product_id); + console.log("REQ URL", req.url, "QUERY", req.query, "PAID", paid); if(!paid) { api.error(402, "Payment required to access this course."); diff --git a/commands/dumpup.js b/commands/examples/dumpup.js similarity index 100% rename from commands/dumpup.js rename to commands/examples/dumpup.js