File tree Expand file tree Collapse file tree 5 files changed +20
-24
lines changed
ProposalEditor/EditorContent Expand file tree Collapse file tree 5 files changed +20
-24
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ export const getProposalNotifications = () => async (dispatch) => {
5252 dispatch ( setRequestStatus ( false ) ) ;
5353 if ( res . status === 200 ) {
5454 dispatch ( setRequestStatus ( true ) ) ;
55- console . log ( "Proposal notification " , res . data . notifications ) ;
55+ console . log ( "Proposal notification " , res . data ? .notifications ) ;
5656 dispatch ( {
5757 type : GET_PROPOSAL_NOTIFICATIONS ,
5858 payload : res . data . notifications ,
Original file line number Diff line number Diff line change @@ -36,29 +36,23 @@ function StyledDropzone(props) {
3636 const [ proposalId , setProposalId ] = useState ( props . idContent ) ;
3737
3838 const onDrop = useCallback ( ( acceptedFiles ) => {
39- if ( proposalId === "new" ) {
40- toast . error (
41- "Please save the proposal as a draft before attaching images"
42- ) ;
43- } else {
44- let formData = new FormData ( ) ;
45- formData . append ( "file" , acceptedFiles [ 0 ] ) ;
46- const URL = `http://localhost:5000/proposal/attach/${ props . idContent } ` ;
39+ let formData = new FormData ( ) ;
40+ formData . append ( "file" , acceptedFiles [ 0 ] ) ;
41+ const URL = `http://localhost:5000/proposal/attach/${ props . idContent } ` ;
4742
48- fetch ( URL , {
49- method : "POST" ,
50- body : formData ,
51- headers : {
52- Authorization : localStorage . getItem ( "jwtToken" ) ,
53- } ,
43+ fetch ( URL , {
44+ method : "POST" ,
45+ body : formData ,
46+ headers : {
47+ Authorization : localStorage . getItem ( "jwtToken" ) ,
48+ } ,
49+ } )
50+ . then ( ( res ) => {
51+ toast . success ( "Image successfully attached to proposal!" ) ;
5452 } )
55- . then ( ( res ) => {
56- toast . success ( "Image successfully attached to proposal!" ) ;
57- } )
58- . catch ( ( err ) => {
59- console . log ( err ) ;
60- } ) ;
61- }
53+ . catch ( ( err ) => {
54+ console . log ( err ) ;
55+ } ) ;
6256 } , [ ] ) ;
6357
6458 const {
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ class EditorContent extends Component {
5050 proposalStatus : fetchedProposal . proposalStatus ,
5151 } ) ;
5252 }
53- if ( Object . keys ( createProposal ) . length !== 0 ) {
53+ if ( Object . keys ( createdProposal ) . length !== 0 ) {
5454 this . setState (
5555 {
5656 isSaving : false ,
Original file line number Diff line number Diff line change 2222 }
2323 .button-container {
2424 .posts {
25+ margin-left : 0px ;
2526 .category {
2627 text-align : left ;
2728 margin-left : 0px ;
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ class Comments extends Component {
4747 }
4848
4949 componentWillReceiveProps ( nextProps ) {
50+ console . log ( 'RECEIVINGGGGGGGGGGGGG' )
5051 console . log ( nextProps ) ;
5152 nextProps . proposalNotifications . forEach ( ( notification , index ) => {
5253 let createdTime = new Date ( notification . createdAt )
@@ -88,7 +89,7 @@ class Comments extends Component {
8889 < div className = "ideas-title" > Comments</ div >
8990 < div className = "ideas-container" >
9091 < ListGroup variant = "flush" >
91- { notifications . map ( ( notification , index ) => {
92+ { notifications ? .map ( ( notification , index ) => {
9293 return (
9394 < ListGroup . Item
9495 key = { index }
You can’t perform that action at this time.
0 commit comments