From bef3abde7481289b4689adccf00afee8fcdf259a Mon Sep 17 00:00:00 2001 From: moepoi Date: Sun, 21 Nov 2021 09:57:12 +0700 Subject: [PATCH] Add controllers for transaction --- controllers/controllers.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/controllers/controllers.js b/controllers/controllers.js index 26b84d7..cd19804 100644 --- a/controllers/controllers.js +++ b/controllers/controllers.js @@ -124,11 +124,24 @@ function checkout( .catch((error) => [error.status, []]); } +function transaction(key) { + const conf = { + params: { + key: key, + } + }; + return axios + .post(HOST + "/transaction", null, conf) + .then((response) => [response.status, response.data]) + .catch((error) => [error.status, []]); +} + module.exports = { getProducts, getProduct, register, login, verify_mail, - checkout + checkout, + transaction }; \ No newline at end of file