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/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 6448b03d..7492ed9b 100644 --- a/packages/admin-ui/src/routing/routes.jsx +++ b/packages/admin-ui/src/routing/routes.jsx @@ -93,7 +93,7 @@ const Routes = () => { - + @@ -105,7 +105,10 @@ const Routes = () => {