Small change.

This commit is contained in:
Daniel
2022-06-30 06:16:52 +04:30
parent 6fbcab4bd7
commit 69332c122a
6 changed files with 9 additions and 31 deletions
+1 -14
View File
@@ -24,7 +24,6 @@ function App() {
[filterCheckbox, setFilterCheckbox] = useState([true, true, true]),
[sortBy, setSortBy] = useState(1),
[loader, setLoader] = useState(false),
[path, setPath] = useState("/"),
[lightMode, setLightMode] = useState(
localStorage.getItem("light-mode") === "true"
),
@@ -58,10 +57,6 @@ function App() {
setToggle(!toggle);
}
function SetPath(pathname) {
setPath(pathname);
}
const filteredData = filter(data, searchQuery, filterCheckbox);
async function fetchData() {
@@ -78,11 +73,6 @@ function App() {
// eslint-disable-next-line
}, [sortBy, filterCheckbox]);
useEffect(() => {
const currentURL = new URL(window.location.href);
SetPath(currentURL.pathname);
}, [path]);
useEffect(() => {
fetchData();
// eslint-disable-next-line
@@ -123,7 +113,7 @@ function App() {
<input
className="search"
type="search"
placeholder={` Search "${path}"`}
placeholder=" Search"
onChange={search}
/>
@@ -185,7 +175,6 @@ function App() {
element={
<div className="content">
<List
SetPath={() => SetPath()}
lightMode={lightMode}
SetLoader={SetLoader}
data={filteredData}
@@ -201,7 +190,6 @@ function App() {
path="tags/:tagId"
element={
<Tags
SetPath={() => SetPath()}
lightMode={lightMode}
SetLoader={SetLoader}
data={filteredData}
@@ -216,7 +204,6 @@ function App() {
path="collections/:collectionId"
element={
<Collections
SetPath={() => SetPath()}
lightMode={lightMode}
SetLoader={SetLoader}
data={filteredData}