Progress
This commit is contained in:
@@ -3,7 +3,7 @@ import { Button, Card, Input, Space, Table } from "antd";
|
||||
import queryString from "query-string";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import { useSearchParams } from "react-router-dom";
|
||||
import { alphaSort } from "../../utils/sorters";
|
||||
|
||||
export default function VendorsListComponent({
|
||||
@@ -13,7 +13,7 @@ export default function VendorsListComponent({
|
||||
vendors,
|
||||
refetch,
|
||||
}) {
|
||||
const search = queryString.parse(useLocation().search);
|
||||
const search = queryString.parse(useSearchParams().toString());
|
||||
const { selectedvendor } = search;
|
||||
|
||||
const [state, setState] = useState({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useQuery } from "@apollo/client";
|
||||
import queryString from "query-string";
|
||||
import React from "react";
|
||||
import { useNavigate, useLocation } from "react-router-dom";
|
||||
import { useNavigate, useSearchParams } from "react-router-dom";
|
||||
import AlertComponent from "../../components/alert/alert.component";
|
||||
import { QUERY_ALL_VENDORS } from "../../graphql/vendors.queries";
|
||||
import VendorsListComponent from "./vendors-list.component";
|
||||
@@ -11,21 +11,21 @@ export default function VendorsListContainer() {
|
||||
fetchPolicy: "network-only",
|
||||
nextFetchPolicy: "network-only",
|
||||
});
|
||||
const search = queryString.parse(useLocation().search);
|
||||
const search = queryString.parse(useSearchParams().toString());
|
||||
const history = useNavigate();
|
||||
|
||||
const handleNewVendor = () => {
|
||||
search.selectedvendor = "new";
|
||||
history.push({ search: queryString.stringify(search) });
|
||||
history({ search: queryString.stringify(search) });
|
||||
};
|
||||
|
||||
const handleOnRowClick = (record) => {
|
||||
if (record) {
|
||||
search.selectedvendor = record.id;
|
||||
history.push({ search: queryString.stringify(search) });
|
||||
history({ search: queryString.stringify(search) });
|
||||
} else {
|
||||
delete search.selectedvendor;
|
||||
history.push({ search: queryString.stringify(search) });
|
||||
history({ search: queryString.stringify(search) });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user