This commit is contained in:
Irtiza-h30
2020-08-19 20:33:36 -04:00
parent 124a84b75f
commit 41f27c76b1

View File

@@ -1,5 +1,5 @@
import React, { useMemo, useContext, useState } from 'react'; import React, { useMemo, useContext, useState } from 'react';
import { Switch, Route, useRouteMatch, Redirect, useLocation } from 'react-router-dom'; import { Switch, Route, useRouteMatch, Redirect } from 'react-router-dom';
import { useQuery, useMutation, useLazyQuery } from '@apollo/react-hooks'; import { useQuery, useMutation, useLazyQuery } from '@apollo/react-hooks';
import { Alert, notification } from 'antd'; import { Alert, notification } from 'antd';
import _ from 'lodash'; import _ from 'lodash';
@@ -22,7 +22,6 @@ import {
const Network = () => { const Network = () => {
const { path } = useRouteMatch(); const { path } = useRouteMatch();
const location = useLocation();
const { customerId } = useContext(UserContext); const { customerId } = useContext(UserContext);
const { loading, error, refetch, data } = useQuery(GET_ALL_LOCATIONS, { const { loading, error, refetch, data } = useQuery(GET_ALL_LOCATIONS, {
variables: { customerId }, variables: { customerId },
@@ -259,13 +258,22 @@ const Network = () => {
path={`${path}/access-points/:id/:tab`} path={`${path}/access-points/:id/:tab`}
render={props => <AccessPointDetails locations={locationsTree} {...props} />} render={props => <AccessPointDetails locations={locationsTree} {...props} />}
/> />
<Route
exact
path={`${path}/access-points/:id`}
render={props => (
<Redirect
to={{ pathname: `${path}/access-points/${props?.match?.params?.id}/general` }}
/>
)}
/>
<Route <Route
exact exact
path={`${path}/client-devices`} path={`${path}/client-devices`}
render={props => <ClientDevices checkedLocations={checkedLocations} {...props} />} render={props => <ClientDevices checkedLocations={checkedLocations} {...props} />}
/> />
<Route exact path={`${path}/client-devices/:id`} component={ClientDeviceDetails} /> <Route exact path={`${path}/client-devices/:id`} component={ClientDeviceDetails} />
<Redirect from={location.pathname} to={`${location.pathname}/general`} />
<Redirect from={path} to={`${path}/access-points`} /> <Redirect from={path} to={`${path}/access-points`} />
</Switch> </Switch>
</NetworkPage> </NetworkPage>