TJRawlins / IrrigationManagerReact

Frontend irrigation management system (React TS)
1 stars 0 forks source link

React - BUG: Trefle API data validation #31

Closed TJRawlins closed 5 months ago

TJRawlins commented 5 months ago

PlantPage > updateLocalStorageTreflePlant

API call may return no data. When this happens, it updates treflePlant in local storage with "undefined". This causing the errors in PlantView component where it's being pulled from local storage and used.

TJRawlins commented 5 months ago

Created validation to check if meta.total equals 0. If so, instead of setting trefle plant local storage to undefined, it creates an instance of the TreflePlant class and uses the default values instead.