I have a graphQL API built on 8base that is connected to my app.
I have a list of categories that users can add to. The form has just a title, a parent category dropdown (that is optional if the category being created is a subcategory). and a submit button.
The API has two tables, one is for categories, the second is for subcategories that is related to objects in the first table.
There are 3 API calls one is for the categories, the second is for the subcategories and the third is the list of categories.
The parent category dropdown uses the api call for the list of categories.
What I am trying to do is make it so my form uses the category api call if the parent category dropdown doesn’t have a category selected and if it does it should use the subcategory api call.
I appreciate the help