radical-doubting / anikultura-frontend

Farmer Dashboard PWA for Anikultura using Angular and Ionic.
MIT License
2 stars 0 forks source link

Stuck in a loading screen if logged in farmer does not belong to a farmland #23

Closed jgarivera closed 2 years ago

jgarivera commented 2 years ago

Description

This is caused by an error: Cannot read properties of undefined (reading 'id') because the farmland endpoint returns an empty { data: [] } response.

Reproduction steps

  1. Log in to farmer dashboard with farmer that does not have farmlands.
  2. Finish tutorial (if applicable).
  3. Observe.

Expected behavior

The dashboard should gracefully handle the farmer's absence of farmlands.

Relevant log output

ERROR TypeError: Cannot read properties of undefined (reading 'id')
    at Z._next (5058.b1aee07fe5de740f.js:1:20050)
    at Z.__tryOrUnsub (main.1c35e3ae28310a4a.js:1:177335)
    at Z.next (main.1c35e3ae28310a4a.js:1:176558)
    at $._next (main.1c35e3ae28310a4a.js:1:175726)
    at $.next (main.1c35e3ae28310a4a.js:1:175500)
    at be._next (main.1c35e3ae28310a4a.js:1:189216)
    at be.next (main.1c35e3ae28310a4a.js:1:175500)
    at be._next (main.1c35e3ae28310a4a.js:1:189216)
    at be.next (main.1c35e3ae28310a4a.js:1:175500)
    at be._next (main.1c35e3ae28310a4a.js:1:188362)

Affected browsers (if applicable)

Firefox, Chrome, Safari, Microsoft Edge