Skip to content

Commit

Permalink
draft work commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Angryman18 committed Sep 20, 2022
1 parent 77b942a commit 6ccfd2d
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/common/search/FilterPlays.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Modal } from "common";
import { useContext, useState } from "react";
import { useContext, useState, useEffect } from "react";
import { useLocation, useNavigate } from "react-router-dom";
import { SearchContext } from "./search-context";
import "./search.css";
Expand Down Expand Up @@ -219,10 +219,26 @@ const FilterPlays = () => {
});
const [noOfAppliedFilter, setnoOfAppliedFilter] = useState(0);

useEffect(() => {
if (location.pathname !== '/plays') {
setModifiedFilterQuery({
level_id: "",
tags: [],
owner_user_id: "",
language: "",
});
setFilterQuery({
level_id: "",
tags: [],
owner_user_id: "",
language: "",
});
setnoOfAppliedFilter(0);
}
},[location.pathname])

const handleFilter = (event) => {
event.preventDefault();
console.log("filterQuery", filterQuery);
console.log("modifiedFilterQuery", modifiedFilterQuery);
setFilterQuery(modifiedFilterQuery);
setnoOfAppliedFilter(getAppliedFilter(modifiedFilterQuery));
if (location.pathname !== "/plays") {
Expand Down

0 comments on commit 6ccfd2d

Please sign in to comment.