From d8237b0005e17a38218b597b731d41ba98b38a1d Mon Sep 17 00:00:00 2001 From: Luis Felipe Risch <lfr20@inf.ufpr.br> Date: Mon, 22 Mar 2021 09:23:55 -0300 Subject: [PATCH] When user changed type of the data(learn Obj, coll, user) by the dropdown, the Url changes --- src/Pages/Search.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Pages/Search.js b/src/Pages/Search.js index 3b94cc8f..9453795c 100644 --- a/src/Pages/Search.js +++ b/src/Pages/Search.js @@ -18,7 +18,7 @@ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/> import React, { useEffect, useState, useContext } from "react"; import { apiDomain } from '../env'; -import { Link } from "react-router-dom"; +import { Link, useHistory } from "react-router-dom"; import styled from "styled-components"; import Paper from "@material-ui/core/Paper"; import LoadingSpinner from '../Components/LoadingSpinner'; @@ -43,6 +43,8 @@ let currFilter = ""; let currOption; export default function Search(props) { + const history = useHistory() + const { state, dispatch } = useContext(Store); const [resultsResource, setResultsResource] = useState([]); const [resultsCollection, setResultsCollection] = useState([]); @@ -164,8 +166,9 @@ export default function Search(props) { onChange={(e) => { setIsLoading(true); currOption = e.value; + history.push(`/busca?query=${state.search.query}&search_class=${currOption}`) setOption(currOption); - collectStuff(currOption, ""); + // collectStuff(currOption, ""); }} placeholder="Selecione um tipo" /> -- GitLab