0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 16:22:44 +00:00

Remove redundant validation check

`performSearch()` and `loadTotal()` shouldn't need a separate check for valid items if `loadPage` already does it through `validateForm`
This commit is contained in:
Trevor Buckner
2024-09-04 00:43:12 -04:00
parent 373a627c14
commit a1e585ccaa

View File

@@ -60,8 +60,6 @@ const VaultPage = (props) => {
const performSearch = async (title, author, count, v3, legacy, page) => {
updateUrl(title, author, count, v3, legacy, page);
if (!((title || author) && (v3 || legacy)))
return;
const response = await request.get(
`/api/vault?title=${title}&author=${author}&v3=${v3}&legacy=${legacy}&count=${count}&page=${page}`
@@ -80,8 +78,6 @@ const VaultPage = (props) => {
const loadTotal = async (title, author, v3, legacy) => {
setTotalBrews(null);
if (!((title || author) && (v3 || legacy)))
return;
const response = await request.get(
`/api/vault/total?title=${title}&author=${author}&v3=${v3}&legacy=${legacy}`
@@ -135,7 +131,6 @@ const VaultPage = (props) => {
const validateForm = () => {
//form validity: title or author must be written, and at least one renderer set
const isTitleValid = titleRef.current.validity.valid && titleRef.current.value;
const isAuthorValid = authorRef.current.validity.valid && authorRef.current.value;
const isCheckboxChecked = legacyRef.current.checked || v3Ref.current.checked;