File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export type Post = RawPost & {
3434 cachedComments ( this : Post ) : Post [ ] | undefined ;
3535 submitReply (
3636 this : Post ,
37- opts : { content : string ; attachment ?: File }
37+ opts : { content : string ; attachment ?: File , poll ?: { choices : string [ ] } ; }
3838 ) : Promise < any > ;
3939} ;
4040
@@ -193,6 +193,7 @@ export function usePosts() {
193193 content : formattedContent ,
194194 attachment : opts . attachment ,
195195 replyToPostId : this . id ,
196+ poll : opts . poll ,
196197 } ) . catch ( ( err ) => {
197198 alert ( err . message ) ;
198199 } ) ;
Original file line number Diff line number Diff line change @@ -158,24 +158,28 @@ function NewPostArea(props: {
158158 const onCreateClick = ( ) => {
159159 const tempContent = content ( ) ;
160160 const formattedContent = formatMessage ( content ( ) . trim ( ) ) ;
161+ const pollOpts = [ ...pollOptions ] ;
162+
161163 if ( props . postId ) {
162164 posts
163165 . cachedPost ( props . postId )
164166 ?. submitReply ( {
165167 content : formattedContent ,
166168 attachment : attachedFile ( ) ,
169+ poll : showPollOptions ( ) ? { choices : pollOpts } : undefined ,
167170 } )
168171 . then ( ( res ) => {
169172 if ( ! res ) {
170173 setContent ( tempContent ) ;
171174 }
172175 } ) ;
173176 } else {
177+ console . log ( pollOpts ) ;
174178 posts
175179 . submitPost ( {
176180 content : formattedContent ,
177181 file : attachedFile ( ) ,
178- poll : showPollOptions ( ) ? { choices : pollOptions } : undefined ,
182+ poll : showPollOptions ( ) ? { choices : pollOpts } : undefined ,
179183 } )
180184 . then ( ( res ) => {
181185 if ( ! res ) {
You can’t perform that action at this time.
0 commit comments