File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ const NewStory = () => {
4848
4949 const [ screenSize , setScreenSize ] = useState ( 0 )
5050
51- const [ attachments , setAttachments ] = useState ( )
51+ const [ attachments , setAttachments ] = useState ( [ ] )
5252
5353 useLayoutEffect ( ( ) => {
5454 function updateScreenSize ( ) {
@@ -127,9 +127,11 @@ const NewStory = () => {
127127 data . Description = filterDescriptionText ( description )
128128 const formData = new FormData ( )
129129 formData . append ( 'data' , JSON . stringify ( data ) )
130- attachments . forEach ( ( file ) => {
131- formData . append ( 'files.Attachment' , file )
132- } )
130+ if ( attachments . length ) {
131+ attachments . forEach ( ( file ) => {
132+ formData . append ( 'files.Attachment' , file )
133+ } )
134+ }
133135 await userStory . createStory ( formData )
134136 navigate ( '/' )
135137 }
You can’t perform that action at this time.
0 commit comments