1- import React , { useEffect } from "react" ;
1+ import { useEffect } from "react" ;
22// State Management
33import { useAtomValue , useSetAtom } from 'jotai' ;
44import { bigStateAtom , clientSettingsAtom , clientSettingsInitial } from '../atoms/settingsState' ;
@@ -10,7 +10,7 @@ import axios from 'axios';
1010import { programStatusAtom } from "atoms/programAtom" ;
1111import { handleFetchFail } from "helpers/axios" ;
1212// Types
13- import { CommentListObject , CommentListResponseObject } from "types/commentTypes" ;
13+ import { CommentListObject } from "types/commentTypes" ;
1414
1515const DashboardFetch = ( ) => {
1616
@@ -63,7 +63,7 @@ const DashboardFetch = () => {
6363 }
6464
6565 // Pluck out the commentlist result
66- const commentlist : Record < string , CommentListResponseObject > = response . data . data . commentlist ;
66+ const commentlist = _ . get ( response . data . data , ' commentlist' , { } ) ;
6767
6868 // Massage the commentlist so we have one key per hostname
6969 const commentlistObject : CommentListObject = {
@@ -152,7 +152,7 @@ const DashboardFetch = () => {
152152 }
153153
154154 // Pluck out the hostgrouplist result
155- const hostgroup = _ . get ( response . data , 'hostgrouplist' , { } ) ;
155+ const hostgroup = _ . get ( response . data . data , 'hostgrouplist' , { } ) ;
156156
157157 setHostgroup ( {
158158 error : false ,
@@ -195,8 +195,8 @@ const DashboardFetch = () => {
195195 return ;
196196 }
197197
198- // Pluck out the hostgrouplist result
199- const servicegroup = _ . get ( response . data , 'servicegrouplist' , { } ) ;
198+ // Pluck out the servicegrouplist result
199+ const servicegroup = _ . get ( response . data . data , 'servicegrouplist' , { } ) ;
200200
201201 setServicegroup ( {
202202 error : false ,
@@ -239,12 +239,15 @@ const DashboardFetch = () => {
239239 return ;
240240 }
241241
242+ // Pluck out the programstatus result
243+ const programstatus = _ . get ( response . data . data , 'programstatus' , { } ) ;
244+
242245 setProgramStatus ( {
243246 error : false ,
244247 errorCount : 0 ,
245248 errorMessage : '' ,
246249 lastUpdate : new Date ( ) . getTime ( ) ,
247- response : response . data ,
250+ response : programstatus ,
248251 } ) ;
249252
250253 } ) . catch ( error => {
0 commit comments