Skip to content

Commit 6525f66

Browse files
authored
Merge pull request #29 from alpenlabs/fix-search-React-Error#321
fix: hook moved to top level component as it was blocking search requests
2 parents ebc8a18 + 4803f7d commit 6525f66

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

frontend/src/components/SearchSection.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import { useState } from "react";
22
import { Link, useNavigate } from "react-router-dom";
3-
import styles from '../styles/SearchSection.module.css';
43
import { useConfig } from "../hooks/useConfig";
4+
import styles from '../styles/SearchSection.module.css';
55

66
const SearchSection = () => {
77
const [query, setQuery] = useState("");
88
const [error, setError] = useState(false); // State to track error visibility
99
const navigate = useNavigate();
10+
const { apiBaseUrl } = useConfig();
1011

1112
const handleSearch = async (e: React.FormEvent) => {
1213
e.preventDefault();
1314
if (!query.trim()) return;
1415

1516
try {
16-
const { apiBaseUrl } = useConfig();
1717
const response = await fetch(
1818
`${apiBaseUrl}/api/search?query=${query.trim()}&ps=1`);
1919
const result = await response.json();

0 commit comments

Comments
 (0)