@@ -35,7 +35,8 @@ interface SprintStatisticsResponse {
35
35
interface PlannerTableProps {
36
36
selectedSprintId : number | null ;
37
37
refreshTrigger : number ;
38
- onLoadingChange ?: ( isLoading : boolean ) => void ;
38
+ setLoading : ( isLoading : boolean ) => void ;
39
+ loading : boolean ;
39
40
}
40
41
41
42
const LoadingSkeleton = ( ) => {
@@ -79,10 +80,10 @@ const LoadingSkeleton = () => {
79
80
const PlannerTable : React . FC < PlannerTableProps > = ( {
80
81
selectedSprintId,
81
82
refreshTrigger,
82
- onLoadingChange
83
+ setLoading,
84
+ loading
83
85
} ) => {
84
86
const [ statistics , setStatistics ] = React . useState < SprintStatisticsResponse | null > ( null ) ;
85
- const [ isLoading , setIsLoading ] = React . useState ( false ) ;
86
87
const [ error , setError ] = React . useState < string | null > ( null ) ;
87
88
88
89
const fetchControllerRef = React . useRef < AbortController | null > ( null ) ;
@@ -103,34 +104,44 @@ const PlannerTable: React.FC<PlannerTableProps> = ({
103
104
const controller = new AbortController ( ) ;
104
105
fetchControllerRef . current = controller ;
105
106
106
- setIsLoading ( true ) ;
107
- onLoadingChange ?.( true ) ;
107
+ setLoading ( true ) ;
108
108
setError ( null ) ;
109
109
110
110
try {
111
+ const assigneesData = localStorage . getItem ( 'JIRA_DEFAULT_ASSIGNEES' ) ;
112
+ if ( ! assigneesData ) {
113
+ throw new Error ( 'No team selected' ) ;
114
+ }
115
+
116
+ const assignees = JSON . parse ( assigneesData ) ;
111
117
const response = await fetch (
112
118
`${ process . env . NEXT_PUBLIC_API_URL } /jira/${ selectedSprintId } /statistics` ,
113
119
{
120
+ method : 'POST' ,
114
121
signal : controller . signal ,
115
122
headers : {
116
123
'Cache-Control' : 'no-cache' ,
117
- 'Pragma' : 'no-cache'
118
- }
124
+ 'Pragma' : 'no-cache' ,
125
+ 'Content-Type' : 'application/json'
126
+ } ,
127
+ body : JSON . stringify ( { assignees } )
119
128
}
120
129
) ;
121
130
if ( ! response . ok ) {
122
- throw new Error ( 'Failed to fetch sprint statistics' ) ;
131
+ const errorData = await response . json ( ) ;
132
+ console . error ( 'Sprint statistics error:' , errorData ) ;
133
+ throw new Error ( errorData . error || 'Failed to fetch sprint statistics' ) ;
123
134
}
124
135
const data : SprintStatisticsResponse = await response . json ( ) ;
125
136
setStatistics ( data ) ;
137
+ setLoading ( false ) ;
126
138
} catch ( err ) {
127
139
if ( err instanceof Error && err . name === 'AbortError' ) {
128
140
return ;
129
141
}
142
+ setLoading ( false ) ;
130
143
setError ( err instanceof Error ? err . message : 'An error occurred' ) ;
131
144
} finally {
132
- setIsLoading ( false ) ;
133
- onLoadingChange ?.( false ) ;
134
145
if ( controller === fetchControllerRef . current ) {
135
146
fetchControllerRef . current = null ;
136
147
}
@@ -149,7 +160,7 @@ const PlannerTable: React.FC<PlannerTableProps> = ({
149
160
150
161
return (
151
162
< div className = "gurubu-planner-table" >
152
- { isLoading ? (
163
+ { loading ? (
153
164
< LoadingSkeleton />
154
165
) : error ? (
155
166
< div className = "gurubu-planner-table-error" >
@@ -170,7 +181,7 @@ const PlannerTable: React.FC<PlannerTableProps> = ({
170
181
< div className = "body-cell" >
171
182
< div className = "assignee-info" >
172
183
< IconUserFilled size = { 24 } className = "assignee-avatar" />
173
- < span > { stat . assignee . name } </ span >
184
+ < span > { stat . assignee . displayName } </ span >
174
185
</ div >
175
186
</ div >
176
187
< div className = "body-cell" > { stat . assignedTasks . length || stat . testTasks . length } </ div >
0 commit comments