CodeForBoulder / upswyng

UpSwyng is a mobile-ready, digital directory of resources to assist the unhoused and at-risk communities of Boulder, CO
https://www.upswyng.org
MIT License
19 stars 21 forks source link

[web] Fetch categories from the server #342

Open rhinodavid opened 4 years ago

rhinodavid commented 4 years ago

As it stands today, the web app uses a hard-coded list of categories (https://github.com/CodeForBoulder/upswyng/blob/master/packages/upswyng-web/src/components/Categories.tsx).

However, the database has a Category table, as well as an endpoint to serve them (https://github.com/CodeForBoulder/upswyng/blob/master/packages/upswyng-server/src/routes/api/categories.ts).

Right now we've got a fragile situation because nothing ensures that these two data sources are in sync. We need to remove the dependency on the hard-coded categories and instead fetch them from the server.

A broad overview of the steps:

rhinodavid commented 4 years ago

A different option -- we could extract the categories/subcategories in the setupCategories.ts script and put them in core and just have both packages reference them