Apihouse icon indicating copy to clipboard operation
Apihouse copied to clipboard

Bug: "Select Catagory" as a input.value causes a waste of a fetch request.

Open MohamedBakoush opened this issue 2 years ago • 0 comments

For getApis() at app.js the input.value isn't checked to see if a valid category is selected causing the system to waste fetch requests if an invalid category was selected.

https://github.com/rutikwankhade/Apihouse/blob/4b3243b8828b2dc087c6c3c58ef6ffd4cbc52673/app.js#L20-L26

To Reproduce Steps to reproduce the behaviour:

  1. Selected "Select Catagory" as a Catagory
  2. Click "show API's"
  3. See "Sorry, Something went wrong !" error

Potential Solution

A simple solution would be to put a validity checker above renderLoader() by exiting getApis() function if a category == "Select Category". As "Select Category" is the only available invalid selectable category from the current option's, making a simple if statement all that's needed to fix this bug.

if (category === "Select Category") return;

MohamedBakoush avatar Jun 26 '22 09:06 MohamedBakoush