feature/IO-3255-simplified-parts-management - Checkpoint
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import React from "react";
|
||||
import VehiclesListComponent from "./vehicles-list.component";
|
||||
import { useQuery } from "@apollo/client";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
@@ -6,10 +5,18 @@ import { QUERY_ALL_VEHICLES_PAGINATED } from "../../graphql/vehicles.queries";
|
||||
import queryString from "query-string";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import { pageLimit } from "../../utils/config";
|
||||
import { connect } from "react-redux";
|
||||
import { selectIsPartsEntry } from "../../redux/application/application.selectors";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
|
||||
export default function VehiclesListContainer() {
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
isPartsEntry: selectIsPartsEntry
|
||||
});
|
||||
|
||||
export function VehiclesListContainer({ isPartsEntry }) {
|
||||
const searchParams = queryString.parse(useLocation().search);
|
||||
const { page, sortcolumn, sortorder, search } = searchParams;
|
||||
const basePath = isPartsEntry ? "/parts" : "/manage";
|
||||
|
||||
const { loading, error, data, refetch } = useQuery(QUERY_ALL_VEHICLES_PAGINATED, {
|
||||
variables: {
|
||||
@@ -33,6 +40,9 @@ export default function VehiclesListContainer() {
|
||||
vehicles={data ? data.search_vehicles : null}
|
||||
total={data ? data.search_vehicles_aggregate.aggregate.count : 0}
|
||||
refetch={refetch}
|
||||
basePath={basePath}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps)(VehiclesListContainer);
|
||||
|
||||
Reference in New Issue
Block a user