Skip to content

Commit 0f99b07

Browse files
Fixing proposal functionality issues (#553)
1 parent 8b3ac65 commit 0f99b07

File tree

5 files changed

+20
-24
lines changed

5 files changed

+20
-24
lines changed

src/actions/notificationAction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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,

src/user/proposals/ProposalEditor/EditorContent/DropZone.js

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff 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 {

src/user/proposals/ProposalEditor/EditorContent/EditorContent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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,

src/user/proposals/UserProposalDashboard/DashboardContent/DashboardContent.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
}
2323
.button-container {
2424
.posts {
25+
margin-left: 0px;
2526
.category {
2627
text-align: left;
2728
margin-left: 0px;

src/user/proposals/UserProposalDashboard/DashboardRightPanel/Comments/Comments.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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}

0 commit comments

Comments
 (0)