#115 Don't access package calendars on non 200 response
Merged 3 years ago by lbrabec. Opened 3 years ago by frantisekz.

@@ -220,7 +220,7 @@ 

          ? []

          : R.keys(state.user_data.static_info.data.group_packages),

      has_calendars:

-       state.user_data === undefined

+       state.user_data === undefined || state.user_data.static_info.status !== 200

          ? false

          : R.compose(

              R.length,

Let's have following response from backend:

{
  "abrt_reports": {
    "data": null, 
    "status": 404
  }, 
  "bzs": {
    "data": null, 
    "status": 404
  }, 
  "prs": {
    "data": null, 
    "status": 404
  }, 
  "static_info": {
    "data": null, 
    "last_synced": null, 
    "status": 404
  }
}

frontend fails with:

TypeError: Cannot read property 'calendars' of null in Connect(Options) (at Masthead/index.js:130) in div (at Masthead/index.js:72) in div (at Masthead/index.js:71) in Masthead (created by Connect(Masthead)) in Connect(Masthead) (at DashboardLayout.js:10) in div (at DashboardLayout.js:9) in DashboardLayout (created by Connect(DashboardLayout)) in Connect(DashboardLayout) (at DashboardNonPackager.js:8) in DashboardNonPackager (created by Connect(DashboardNonPackager)) in Connect(DashboardNonPackager) (at Dashboard/index.js:84) in Dashboard (created by Connect(Dashboard)) in Connect(Dashboard) (at App.js:32) in Route (at App.js:31) in Switch (at App.js:27) in Router (created by BrowserRouter) in BrowserRouter (at App.js:26) in App (created by Connect(App)) in Connect(App) (at src/index.js:30) in Provider (at src/index.js:29) in StrictMode (at src/index.js:28)

Pull-Request has been merged by lbrabec

3 years ago
Metadata