-
Notifications
You must be signed in to change notification settings - Fork 219
Integrating /proposal route and improved proposal editor page #484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
vaibhavdaren
merged 9 commits into
codeuino:development
from
AuraOfDivinity:general-improvements
Jul 4, 2020
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4dcba66
Integrating /proposal route and improved proposal editor page
AuraOfDivinity ca92134
Changing editor to tinymce
AuraOfDivinity f7eb4e2
fixing conflicts
AuraOfDivinity f421b31
Integration of notifications and minor improvements
AuraOfDivinity e38f279
Issues with redux
AuraOfDivinity 03d3f4f
integrating redux for state management and other requested changes
AuraOfDivinity 456676f
fixing conflicts
AuraOfDivinity ac04c77
Requested changes
AuraOfDivinity 21228dd
removing edits caused in memberInfo.scss
AuraOfDivinity File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,41 +1,63 @@ | ||
| import { GET_PLATFORM_NOTIFICATIONS, GET_USER_NOTIFICATIONS } from './types' | ||
| import axios from 'axios' | ||
| import { errorHandler } from '../utils/errorHandler'; | ||
| import { setRequestStatus } from '../utils/setRequestStatus'; | ||
| import { | ||
| GET_PLATFORM_NOTIFICATIONS, | ||
| GET_USER_NOTIFICATIONS, | ||
| GET_PROPOSAL_NOTIFICATIONS, | ||
| } from "./types"; | ||
| import axios from "axios"; | ||
| import { errorHandler } from "../utils/errorHandler"; | ||
| import { setRequestStatus } from "../utils/setRequestStatus"; | ||
|
|
||
| // GET NOTIFICATIONS FOR WHOLE PLATFORM AS WELL AS FOR A USER | ||
| export const getAllNotifications = () => async (dispatch) => { | ||
| try { | ||
| const res = await axios.get('/notification/org/all') | ||
| dispatch(setRequestStatus(false)) | ||
| const res = await axios.get("/notification/org/all"); | ||
| dispatch(setRequestStatus(false)); | ||
| if (res.status === 200) { | ||
| dispatch(setRequestStatus(true)) | ||
| console.log('Whole platform notification ', res.data.notifications) | ||
| dispatch(setRequestStatus(true)); | ||
| console.log("Whole platform notification ", res.data.notifications); | ||
|
|
||
| dispatch({ | ||
| type: GET_PLATFORM_NOTIFICATIONS, | ||
| payload: res.data.notifications | ||
| }) | ||
| payload: res.data.notifications, | ||
| }); | ||
| } | ||
| } catch (error) { | ||
| dispatch(errorHandler(error)) | ||
| dispatch(errorHandler(error)); | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| // GET NOTIFICATIONS FOR A USER | ||
| export const getUserNotification = () => async (dispatch) => { | ||
| try { | ||
| const res = await axios.get('/notification/user/all') | ||
| dispatch(setRequestStatus(false)) | ||
| const res = await axios.get("/notification/user/all"); | ||
| dispatch(setRequestStatus(false)); | ||
| if (res.status === 200) { | ||
| dispatch(setRequestStatus(true)) | ||
| console.log('User notification ', res.data.notifications) | ||
| dispatch(setRequestStatus(true)); | ||
| console.log("User notification ", res.data.notifications); | ||
| dispatch({ | ||
| type: GET_USER_NOTIFICATIONS, | ||
| payload: res.data.notifications | ||
| }) | ||
| payload: res.data.notifications, | ||
| }); | ||
| } | ||
| } catch (error) { | ||
| dispatch(errorHandler(error)) | ||
| dispatch(errorHandler(error)); | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| // GET PROPOSAL NOTIFICATIONS | ||
| export const getProposalNotifications = () => async (dispatch) => { | ||
| try { | ||
| const res = await axios.get("/notification/proposal/all"); | ||
| dispatch(setRequestStatus(false)); | ||
| if (res.status === 200) { | ||
| dispatch(setRequestStatus(true)); | ||
| console.log("Proposal notification ", res.data.notifications); | ||
| dispatch({ | ||
| type: GET_PROPOSAL_NOTIFICATIONS, | ||
| payload: res.data.notifications, | ||
| }); | ||
| } | ||
| } catch (error) { | ||
| dispatch(errorHandler(error)); | ||
| } | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| import axios from "axios"; | ||
| import { errorHandler } from "../utils/errorHandler"; | ||
| import { setRequestStatus } from "../utils/setRequestStatus"; | ||
| import { | ||
| CREATE_PROPOSAL, | ||
| GET_PROPOSAL, | ||
| GET_USER_PROPOSAL_NOTIFICATIONS, | ||
| GET_ALL_PROPOSALS, | ||
| GET_USER_PROPOSALS, | ||
| } from "../actions/types"; | ||
|
|
||
| // CREATE PROPOSAL | ||
| export const createProposal = (proposalInfo) => async (dispatch) => { | ||
| try { | ||
| const res = await axios.post("/proposal", proposalInfo); | ||
| dispatch(setRequestStatus(false)); | ||
| if (res.status === 201) { | ||
| dispatch(setRequestStatus(true)); | ||
| console.log("proposal created in ACTION", res.data); | ||
| dispatch({ | ||
| type: CREATE_PROPOSAL, | ||
| payload: res.data.proposal || res.data.msg, | ||
| }); | ||
| } | ||
| } catch (error) { | ||
| dispatch(errorHandler(error)); | ||
| } | ||
| }; | ||
|
|
||
| // GET PROPOSAL DATA | ||
| export const getProposal = (proposalId) => async (dispatch) => { | ||
| try { | ||
| const res = await axios.get("/proposal/" + proposalId); | ||
| dispatch(setRequestStatus(false)); | ||
| if (res.status === 200) { | ||
| dispatch(setRequestStatus(true)); | ||
| console.log("proposal data fetched in action", res.data); | ||
| dispatch({ | ||
| type: GET_PROPOSAL, | ||
| payload: res.data.proposal || res.data.msg, | ||
| }); | ||
| } | ||
| } catch (error) { | ||
| dispatch(errorHandler(error)); | ||
| } | ||
| }; | ||
|
|
||
| // SAVE PROPOSAL DATA | ||
| export const saveProposal = (proposalData) => async (dispatch) => { | ||
| try { | ||
| const res = await axios.patch( | ||
| "/proposal/" + proposalData.proposalId, | ||
| proposalData | ||
| ); | ||
| dispatch(setRequestStatus(false)); | ||
| if (res.status === 200) { | ||
| dispatch(setRequestStatus(true)); | ||
| } | ||
| } catch (error) { | ||
| dispatch(errorHandler(error)); | ||
| } | ||
| }; | ||
|
|
||
| // SUBMIT PROPOSAL | ||
| export const submitProposal = (proposalData) => async (dispatch) => { | ||
| console.log(proposalData); | ||
| try { | ||
| const res = await axios.patch( | ||
| "/proposal/change/" + proposalData.proposalId, | ||
| proposalData | ||
| ); | ||
| dispatch(setRequestStatus(false)); | ||
| if (res.status === 200) { | ||
| dispatch(setRequestStatus(true)); | ||
| } | ||
| } catch (error) { | ||
| dispatch(errorHandler(error)); | ||
| } | ||
| }; | ||
|
|
||
| // DELETE PROPOSAL | ||
| export const deleteProposal = (proposalId) => async (dispatch) => { | ||
| try { | ||
| const res = await axios.delete("/proposal", { | ||
| headers: {}, | ||
| data: { proposalId: proposalId }, | ||
| }); | ||
| dispatch(setRequestStatus(false)); | ||
| if (res.status === 200) { | ||
| dispatch(setRequestStatus(true)); | ||
| } | ||
| } catch (error) { | ||
| dispatch(errorHandler(error)); | ||
| } | ||
| }; | ||
|
|
||
| // COMMENT ON PROPOSAL | ||
| export const commentProposal = (commentData) => async (dispatch) => { | ||
| try { | ||
| const res = await axios.post("/proposal/comment", commentData); | ||
| dispatch(setRequestStatus(false)); | ||
| if (res.status === 200) { | ||
| dispatch(setRequestStatus(true)); | ||
| } | ||
| } catch (error) { | ||
| dispatch(errorHandler(error)); | ||
| } | ||
| }; | ||
|
|
||
| // GET USER RELATED PROPOSAL NOTIFICATIONS | ||
| export const getUserProposalNotifications = (data) => async (dispatch) => { | ||
| try { | ||
| const res = await axios.post("/proposal/notifications", data); | ||
| console.log(res); | ||
| if (res.status === 200) { | ||
| dispatch(setRequestStatus(true)); | ||
| dispatch({ | ||
| type: GET_USER_PROPOSAL_NOTIFICATIONS, | ||
| payload: res.data.proposal || res.data.msg, | ||
| }); | ||
| } | ||
| } catch (error) { | ||
| dispatch(errorHandler(error)); | ||
| } | ||
| }; | ||
|
|
||
| // GET ALL PROPOSALS | ||
| export const getAllProposals = () => async (dispatch) => { | ||
| try { | ||
| const res = await axios.post("/proposal/all"); | ||
| dispatch(setRequestStatus(false)); | ||
| if (res.status === 200) { | ||
| dispatch(setRequestStatus(true)); | ||
| dispatch({ | ||
| type: GET_ALL_PROPOSALS, | ||
| payload: res.data.proposals || res.data.msg, | ||
| }); | ||
| } | ||
| } catch (error) { | ||
| dispatch(errorHandler(error)); | ||
| } | ||
| }; | ||
|
|
||
| // GET PROPOSALS BY USER ID | ||
| export const getProposalsByUser = (userId) => async (dispatch) => { | ||
| try { | ||
| const res = await axios.get(`/proposal/user/${userId}`); | ||
| dispatch(setRequestStatus(false)); | ||
| if (res.status === 200) { | ||
| dispatch(setRequestStatus(true)); | ||
| dispatch({ | ||
| type: GET_USER_PROPOSALS, | ||
| payload: res.data.proposal || res.data.msg, | ||
| }); | ||
| } | ||
| } catch (error) { | ||
| dispatch(errorHandler(error)); | ||
| } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these formatting changes or code changes by linter did you make these?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vaibhavdaren These are either due to the extensions he is using or due to his vs code settings.
I have already mentioned that