mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-06 00:04:39 +00:00
fix: null as default search value
This commit is contained in:
parent
bfda46f5eb
commit
166af97224
1 changed files with 18 additions and 16 deletions
|
@ -27,10 +27,8 @@ const fetcher = async (url: string) => {
|
||||||
export function SearchPage() {
|
export function SearchPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const [query, setQuery] = useState(searchParams.get("q") || null);
|
const [query, setQuery] = useState(searchParams.get("q") || "");
|
||||||
const [searchVal, setSearchVal] = useState(
|
const [searchVal, setSearchVal] = useState(searchParams.get("q") || "");
|
||||||
decodeURI(searchParams.get("q")) || ""
|
|
||||||
);
|
|
||||||
const [where, setWhere] = useState(searchParams.get("where") || "releases");
|
const [where, setWhere] = useState(searchParams.get("where") || "releases");
|
||||||
const [searchBy, setSearchBy] = useState(
|
const [searchBy, setSearchBy] = useState(
|
||||||
searchParams.get("searchBy") || null
|
searchParams.get("searchBy") || null
|
||||||
|
@ -197,20 +195,24 @@ export function SearchPage() {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{(data && data.length > 1) && (where == "releases"
|
{data &&
|
||||||
|
data.length > 1 &&
|
||||||
|
(where == "releases"
|
||||||
? data[data.length - 1].releases.length == 25
|
? data[data.length - 1].releases.length == 25
|
||||||
: data[data.length - 1].content.length == 25) ? (
|
: data[data.length - 1].content.length == 25) ? (
|
||||||
<Button
|
<Button
|
||||||
className="w-full"
|
className="w-full"
|
||||||
color={"light"}
|
color={"light"}
|
||||||
onClick={() => setSize(size + 1)}
|
onClick={() => setSize(size + 1)}
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<span className="w-6 h-6 iconify mdi--plus-circle "></span>
|
<span className="w-6 h-6 iconify mdi--plus-circle "></span>
|
||||||
<span className="text-lg">Загрузить ещё</span>
|
<span className="text-lg">Загрузить ещё</span>
|
||||||
</div>
|
</div>
|
||||||
</Button>
|
</Button>
|
||||||
) : ""}
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue