From a3dc4504973cef2ef552f16e26fd5345572c88fb Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Fri, 16 May 2025 08:13:11 +0100 Subject: [PATCH 1/2] fix: customer route --- packages/admin-ui/src/pages/Customers/CustomerProfile.jsx | 2 +- packages/admin-ui/src/routing/routes.jsx | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/admin-ui/src/pages/Customers/CustomerProfile.jsx b/packages/admin-ui/src/pages/Customers/CustomerProfile.jsx index e98ca5f6..5a102a3b 100644 --- a/packages/admin-ui/src/pages/Customers/CustomerProfile.jsx +++ b/packages/admin-ui/src/pages/Customers/CustomerProfile.jsx @@ -285,7 +285,6 @@ const CHECK_AGAINST_SANCTIONS = gql` const CustomerProfile = memo(() => { const [, navigate] = useLocation() - const [showCompliance, setShowCompliance] = useState(false) const [wizard, setWizard] = useState(false) const [error, setError] = useState(null) @@ -298,6 +297,7 @@ const CustomerProfile = memo(() => { loading: customerLoading, } = useQuery(GET_CUSTOMER, { variables: { customerId }, + skip: !customerId, }) const { data: configResponse, loading: configLoading } = useQuery(GET_DATA) diff --git a/packages/admin-ui/src/routing/routes.jsx b/packages/admin-ui/src/routing/routes.jsx index 6448b03d..78395005 100644 --- a/packages/admin-ui/src/routing/routes.jsx +++ b/packages/admin-ui/src/routing/routes.jsx @@ -105,7 +105,10 @@ const Routes = () => {
From 8405d23deefeab4301e1c5d174204611e8e78638 Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Fri, 16 May 2025 08:15:51 +0100 Subject: [PATCH 2/2] fix: machines/:id routing --- packages/admin-ui/src/pages/Machines/Machines.jsx | 10 ++++------ packages/admin-ui/src/routing/routes.jsx | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/admin-ui/src/pages/Machines/Machines.jsx b/packages/admin-ui/src/pages/Machines/Machines.jsx index 25a242a3..79c01d88 100644 --- a/packages/admin-ui/src/pages/Machines/Machines.jsx +++ b/packages/admin-ui/src/pages/Machines/Machines.jsx @@ -3,7 +3,7 @@ import Breadcrumbs from '@mui/material/Breadcrumbs' import NavigateNextIcon from '@mui/icons-material/NavigateNext' import * as R from 'ramda' import React, { useState } from 'react' -import { Link, useLocation } from 'wouter' +import { Link, useLocation, useParams } from 'wouter' import { TL1, TL2, Label3 } from '../../components/typography' import Cassettes from './MachineComponents/Cassettes' @@ -58,13 +58,11 @@ const GET_INFO = gql` } ` -const getMachineID = path => path.slice(path.lastIndexOf('/') + 1) - const MachineRoute = () => { const [location, navigate] = useLocation() const [loading, setLoading] = useState(true) + const { id: deviceId } = useParams() - const id = getMachineID(location) const { data, refetch } = useQuery(GET_INFO, { onCompleted: data => { if (data.machine === null) return navigate('/maintenance/machine-status') @@ -72,9 +70,9 @@ const MachineRoute = () => { setLoading(false) }, variables: { - deviceId: id, + deviceId, billFilters: { - deviceId: id, + deviceId, batch: 'none', }, }, diff --git a/packages/admin-ui/src/routing/routes.jsx b/packages/admin-ui/src/routing/routes.jsx index 78395005..7492ed9b 100644 --- a/packages/admin-ui/src/routing/routes.jsx +++ b/packages/admin-ui/src/routing/routes.jsx @@ -93,7 +93,7 @@ const Routes = () => {
- +