@@ -35,6 +35,8 @@ const NewStory = () => {
3535 initialDescriptionInputsValue
3636 )
3737
38+ const [ underConsiderationId , setUnderConsiderationId ] = useState ( '' )
39+
3840 const [ description , setDescription ] = useState ( '' )
3941
4042 const [ categories , setCategories ] = useState ( [ ] )
@@ -127,6 +129,21 @@ const NewStory = () => {
127129
128130 trackPromise ( fetchPriorities ( ) )
129131
132+ const fetchUserStoryStatuses = async ( ) => {
133+ const response = await axios . post ( `${ apiURL } /graphql` , {
134+ query : `query {
135+ userStoryStatuses (where: {
136+ Status: "Under consideration"
137+ }) {
138+ id
139+ }
140+ }`
141+ } )
142+ setUnderConsiderationId ( response . data . data . userStoryStatuses [ 0 ] ?. id ?? '' )
143+ }
144+
145+ trackPromise ( fetchUserStoryStatuses ( ) )
146+
130147 const fetchStoriesData = async ( ) => {
131148 const response = await axios . post (
132149 `${ apiURL } /graphql` ,
@@ -164,7 +181,7 @@ const NewStory = () => {
164181 }
165182
166183 const onSubmit = async ( data ) => {
167- if ( description === undefined || description . length <= 0 ) {
184+ if ( ! description ? .length ) {
168185 setDescriptionError ( true )
169186 return
170187 }
@@ -179,7 +196,7 @@ const NewStory = () => {
179196 Description: "${ data . description } "
180197 Title: "${ data . title } "
181198 Category: ${ data . category }
182- user_story_status: "60b5cef600971013c4f269c2 "
199+ user_story_status: "${ underConsiderationId } "
183200 product: "${ data . product } "
184201 Priority: ${ data . priority }
185202 }
0 commit comments