From 250c9f80a23fe4ee7fd9dfcd32b0376eb1715ee2 Mon Sep 17 00:00:00 2001 From: nishekh-e-r Date: Mon, 19 Jun 2023 09:53:41 +0530 Subject: [PATCH] fix:eslint errors --- server/controllers/stripeController.js | 8 ++++---- server/policies/apiToken.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/server/controllers/stripeController.js b/server/controllers/stripeController.js index feebd70..43a64e4 100644 --- a/server/controllers/stripeController.js +++ b/server/controllers/stripeController.js @@ -98,6 +98,7 @@ module.exports = { ); ctx.send(checkoutSessionResponse, 200); }, + async retrieveCheckoutSession(ctx) { try { const { id } = ctx.params; @@ -108,8 +109,7 @@ module.exports = { .retrieveCheckoutSession(id); if (retrieveCheckoutSessionResponse.payment_status === 'paid') { - const { customer_details, amount_total, id, payment_intent, metadata } = - retrieveCheckoutSessionResponse; + const { customer_details, amount_total, id, metadata } = retrieveCheckoutSessionResponse; const queryId = metadata.productId; // get id from productschema @@ -126,7 +126,7 @@ module.exports = { const customerEmail = customer_details.email; const stripeProduct = res.id; - const savePaymentDetails = await strapi.query('plugin::strapi-stripe.ss-payment').create({ + await strapi.query('plugin::strapi-stripe.ss-payment').create({ data: { txnDate, transactionId, @@ -210,7 +210,7 @@ module.exports = { email ); - ctx.send({ url: checkoutSessionResponse?.url }, 200); + ctx.send({ url: checkoutSessionResponse.url }, 200); } } catch (error) { console.error(error); diff --git a/server/policies/apiToken.js b/server/policies/apiToken.js index 9bf8db3..9e15a04 100644 --- a/server/policies/apiToken.js +++ b/server/policies/apiToken.js @@ -1,14 +1,14 @@ 'use strict'; module.exports = async (policyContext, config, { strapi }) => { - const bearerToken = policyContext.request.header?.authorization?.substring('Bearer '.length); + const bearerToken = policyContext.request.header.authorization.substring('Bearer '.length); if (!bearerToken) { return false; } const apiTokenService = strapi.services['admin::api-token']; const accessKey = await apiTokenService.hash(bearerToken); - const storedToken = await apiTokenService.getBy({ accessKey: accessKey }); + const storedToken = await apiTokenService.getBy({ accessKey }); if (!storedToken) { return false;