From ba3a61f30410b1d1684a68b0e95cbdf5c71a306c Mon Sep 17 00:00:00 2001 From: Jesse Shawl Date: Thu, 25 Jan 2024 08:49:36 -0600 Subject: [PATCH] refactor --- src/hosted-buttons/utils.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/hosted-buttons/utils.js b/src/hosted-buttons/utils.js index ebfd6026bf..cfa5de232d 100644 --- a/src/hosted-buttons/utils.js +++ b/src/hosted-buttons/utils.js @@ -131,15 +131,8 @@ export const buildHostedButtonCreateOrder = ({ ...userInputs, }), }) - .then(({ body }) => { - if (!body.context_id) { - onError(body.name); - } - return body.context_id; - }) - .catch(() => { - onError("REQUEST_FAILED"); - }); + .then(({ body }) => body.context_id || onError(body.name)) + .catch(() => onError("REQUEST_FAILED")); }); }; };