From 0cee723871ce56ee2b583dd75888604c1e13d48d Mon Sep 17 00:00:00 2001 From: Alex Luker Date: Mon, 29 Jul 2024 09:38:33 +0100 Subject: [PATCH] Remove the ability to edit a sales session as we dont support it on the producer. Change throw error to attach the error as a cause so we can add the meaningful description. Couldnt find out the ecmascript version shopify is using to know whether this is fully supported --- web/frontend/pages/SalesSession.jsx | 50 ------------------- .../controllers/edit-current-sales-session.js | 45 ----------------- .../sales-session/controllers/index.js | 2 - .../use-cases/edit-current-sales-session.js | 30 ----------- web/oidc-router.js | 2 +- web/utils/index.js | 7 +-- 6 files changed, 2 insertions(+), 134 deletions(-) delete mode 100644 web/modules/sales-session/controllers/edit-current-sales-session.js delete mode 100644 web/modules/sales-session/use-cases/edit-current-sales-session.js diff --git a/web/frontend/pages/SalesSession.jsx b/web/frontend/pages/SalesSession.jsx index 2d19555..b3a5a53 100644 --- a/web/frontend/pages/SalesSession.jsx +++ b/web/frontend/pages/SalesSession.jsx @@ -90,22 +90,6 @@ export default function SalesSession() { }, }); - const { - mutateAsync: editCurrentSalesSession, - isLoading: editCurrentSalesSessionIsLoading, - error: editCurrentSalesSessionError, - } = useAppMutation({ - reactQueryOptions: { - onSuccess: async () => { - await queryClient.invalidateQueries("/api/sales-session"); - setShowSuccessAlert({ - show: true, - type: "updated", - }); - }, - }, - }); - const { mutateAsync: completeCurrentSalesSession, isLoading: completeCurrentSalesSessionIsLoading, @@ -134,22 +118,6 @@ export default function SalesSession() { }, }); - const handleOnEditCurrentSalesSessionClick = async () => { - await editCurrentSalesSession({ - url: "/api/sales-session/current", - fetchInit: { - method: "PATCH", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - startDate: startDate.toISOString(), - sessionDurationInDays: Number(sessionDurationInDays), - }), - }, - }); - }; - const handleOnFinishCurrentSalesSessionClick = async () => { await completeCurrentSalesSession({ url: "/api/sales-session/current/complete", @@ -314,20 +282,6 @@ export default function SalesSession() { {createSalesSessionIsLoading ? "Loading..." : "Create Sales Session"} - -