Skip to content

Commit 630333d

Browse files
authored
Merge branch 'development' into feature-ansible
2 parents a24e0e0 + 01e9575 commit 630333d

File tree

86 files changed

+3886
-832
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+3886
-832
lines changed

.env.production

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#.env.production
2-
REACT_APP_API_ENDPOINT = "https://codeuino-donut-development.herokuapp.com"
2+
REACT_APP_API_ENDPOINT = "https://gsoc-donut.herokuapp.com"
33
REACT_APP_SOCKET_ENDPOINT = "http://localhost:8810"

README.md

Lines changed: 123 additions & 110 deletions
Large diffs are not rendered by default.

package-lock.json

Lines changed: 399 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,17 @@
3535
"react-ga": "^3.1.2",
3636
"react-icons": "^3.10.0",
3737
"react-images": "^1.1.7",
38+
"react-loading-overlay": "^1.0.1",
3839
"react-lottie": "^1.2.3",
39-
"react-markdown-editor-lite": "^1.1.4",
40+
"react-markdown": "^4.3.1",
41+
"react-mde": "^10.2.1",
4042
"react-moment": "^0.9.7",
4143
"react-redux": "^7.2.0",
4244
"react-responsive": "^8.0.3",
4345
"react-router-dom": "^5.1.2",
4446
"react-scripts": "^3.4.0",
4547
"react-shapes": "^0.1.0",
48+
"react-share": "^4.2.1",
4649
"react-spinners": "^0.8.3",
4750
"react-switch": "^5.0.1",
4851
"react-toastify": "^6.0.5",

src/actions/eventAction.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@ import { errorHandler } from '../utils/errorHandler';
33
import { setRequestStatus } from '../utils/setRequestStatus';
44
import { GET_ALL_EVENTS, GET_EVENT_BY_ID } from './types';
55
import { BASE_URL } from './baseApi'
6+
import { customErrorHandler } from '../utils/customErrorHandler';
67

78
// DELETE EVENT REQUEST
89
export const deleteEvent = (eventId) => async (dispatch) => {
910
try {
1011
const res = await axios.delete(`${BASE_URL}/event/${eventId}`)
11-
dispatch(setRequestStatus(false));
1212
if(res.status === 200){
13-
dispatch(setRequestStatus(true));
1413
dispatch(getAllEvents())
1514
}
1615
} catch(error) {
17-
dispatch(errorHandler(error))
16+
const msg = {
17+
error: error?.response?.msg
18+
}
19+
dispatch(customErrorHandler(msg))
1820
}
1921
}
2022

@@ -47,7 +49,7 @@ export const createEvent = (eventInfo, history) => async (dispatch) => {
4749
}
4850

4951
// GET ALL EVENTS
50-
export const getAllEvents = (pagination = 10, page = 1) => async (dispatch) => {
52+
export const getAllEvents = (pagination = 6, page = 1) => async (dispatch) => {
5153
try {
5254
const res = await axios.get(`${BASE_URL}/event/all?pagination=${pagination}&page=${page}`)
5355
dispatch(setRequestStatus(false))

src/actions/orgAction.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import {
66
UPDATE_ORG_PROFILE,
77
DEACTIVATE_ORG,
88
GET_ALL_MEMBERS,
9-
TRIGGER_MAINTENANCE
9+
TRIGGER_MAINTENANCE,
10+
GET_LOGIN_OPTIONS
1011
} from './types'
1112

1213
import { BASE_URL } from './baseApi'
@@ -149,4 +150,20 @@ export const TriggerMaintenance = () => async (dispatch) => {
149150
} catch (error) {
150151
dispatch(errorHandler(error))
151152
}
153+
}
154+
155+
// GET LOGIN OPTIONS
156+
export const getLoginOptions = () => async (dispatch) => {
157+
try {
158+
const res = await axios.get(`${BASE_URL}/org/login/options`)
159+
if(res.status === 200) {
160+
console.log('fetched login options ', res.data)
161+
dispatch({
162+
type: GET_LOGIN_OPTIONS,
163+
payload: res.data.methods
164+
})
165+
}
166+
} catch(error) {
167+
dispatch(errorHandler(error))
168+
}
152169
}

src/actions/postAction.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const updatePost = (postId, updatedInfo) => async (dispatch) => {
8181
console.log("updatedPostInfo ", updatedInfo);
8282
const res = await axios.patch(`${BASE_URL}/post/${postId}`, updatedInfo);
8383
if (res.status === 200) {
84-
dispatch(getPostById(postId));
84+
dispatch(getAllPosts());
8585
}
8686
} catch (error) {
8787
dispatch(errorHandler(error));
@@ -103,11 +103,27 @@ export const deletePost = (postId) => async (dispatch) => {
103103
// REMOVE REACTION
104104
export const removeReaction = (postId, type) => async (dispatch) => {
105105
try {
106-
const res = await axios.patch(`${BASE_URL}/post/removereaction/${postId}`, type);
106+
const res = await axios.patch(
107+
`${BASE_URL}/post/removereaction/${postId}`,
108+
type
109+
);
107110
if (res.status === 200) {
108111
dispatch(getAllPosts());
109112
}
110113
} catch (error) {
111114
dispatch(errorHandler(error));
112115
}
113116
};
117+
118+
// PIN POST BY ID
119+
export const pinPost = (postId) => async (dispatch) => {
120+
try {
121+
const res = await axios.patch(`${BASE_URL}/post/pin/${postId}`)
122+
if (res.status === 200) {
123+
console.log('post pinned ', res.data.post)
124+
dispatch(getAllPinnedPosts(10, 1));
125+
}
126+
} catch(error) {
127+
dispatch(errorHandler(error))
128+
}
129+
}

src/actions/projectAction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const createProject = (projectInfo) => async (dispatch) => {
2020
}
2121

2222
// GET ALL PROJECTS
23-
export const getAllProjects = (pagination = 10, page = 1) => async (dispatch) => {
23+
export const getAllProjects = (pagination = 6, page = 1) => async (dispatch) => {
2424
try {
2525
const res = await axios.get(`${BASE_URL}/project/?pagination=${pagination}&page=${page}`)
2626
dispatch(setRequestStatus(false))

src/actions/types.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,6 @@ export const GET_DEVICE_ANALYTICS ="GET_DEVICE_ANALYTICS"
5353
export const GET_MOSTVIEWED_ANALYTICS ="GET_MOSTVIEWED_ANALYTICS"
5454
export const GET_PROPOSALVIEW_ANALYTICS="GET_PROPOSALVIEW_ANALYTICS"
5555
export const ACTIVATE_DEACTIVATE_ACCOUNT_TOGGLER = "ACTIVATE_DEACTIVATE_ACCOUNT_TOGGLER";
56-
export const CLEAR_INVITE_LINK = "CLEAR_INVITE_LINK"
56+
export const GET_WIKIS = "GET_WIKIS";
57+
export const CLEAR_INVITE_LINK = "CLEAR_INVITE_LINK";
58+
export const GET_LOGIN_OPTIONS = "GET_LOGIN_OPTIONS";

src/actions/usersAction.js

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { errorHandler } from '../utils/errorHandler'
33
import axios from 'axios'
44
import { setRequestStatus } from '../utils/setRequestStatus'
55
import { BASE_URL } from './baseApi'
6+
const userId = localStorage.getItem('userId')
67

78
// GET USER PROFILE
89
export const getProfile = (id) => async (dispatch)=> {
@@ -31,15 +32,12 @@ export const getProfile = (id) => async (dispatch)=> {
3132
// FOLLOW USER
3233
export const followUser = (userId) => async (dispatch) => {
3334
try {
34-
let followObj = {
35-
followId: userId
36-
}
37-
console.log('followObj ', followObj)
38-
const res = await axios.patch(`${BASE_URL}/user/follow`, followObj)
35+
console.log('followuser ', userId)
36+
const res = await axios.patch(`${BASE_URL}/user/follow/${userId}`)
3937
dispatch(setRequestStatus(false))
4038
if (res.status === 200) {
4139
dispatch(setRequestStatus(true))
42-
console.log('started following ', followObj)
40+
console.log('started following ', userId)
4341
dispatch({
4442
type: GET_USER_PROFILE,
4543
payload: res.data.user,
@@ -53,15 +51,12 @@ export const followUser = (userId) => async (dispatch) => {
5351
// UnFOLLOW USER
5452
export const unFollowUser = (userId) => async (dispatch) => {
5553
try {
56-
let unFollowObj = {
57-
followId: userId
58-
}
59-
console.log('unfollowObj ', unFollowObj)
60-
const res = await axios.patch(`${BASE_URL}/user/unfollow`, unFollowObj)
54+
console.log('unfollowObj ', userId)
55+
const res = await axios.patch(`${BASE_URL}/user/unfollow/${userId}`)
6156
dispatch(setRequestStatus(false))
6257
if (res.status === 200) {
6358
dispatch(setRequestStatus(true))
64-
console.log('unfollowed ', unFollowObj)
59+
console.log('unfollowed ', userId)
6560
dispatch({
6661
type: GET_USER_PROFILE,
6762
payload: res.data.user,
@@ -112,11 +107,11 @@ export const updateProfile = (userId, updatedInfo) => async (dispatch) => {
112107
}
113108

114109
// GET EVENTS CREATED BY USER
115-
export const getEventsCreatedByUser = (userId, pagination = 10, page = 1) => async (dispatch) => {
110+
export const getEventsCreatedByUser = (id = userId, pagination = 10, page = 1) => async (dispatch) => {
116111
try {
117-
console.log('getEvents userId ', userId)
112+
console.log('getEvents userId ', id)
118113
const res = await axios
119-
.get(`${BASE_URL}/event/${userId}/all?pagination=${pagination}&page=${page}`);
114+
.get(`${BASE_URL}/event/${id}/all?pagination=${pagination}&page=${page}`);
120115
dispatch(setRequestStatus(false))
121116
if(res.status === 200) {
122117
dispatch(setRequestStatus(true))
@@ -132,11 +127,11 @@ export const getEventsCreatedByUser = (userId, pagination = 10, page = 1) => asy
132127
}
133128

134129
// GET ALL PROJECT CREATED BY A USER
135-
export const getProjectCreatedByUser = (userId, pagination = 10, page = 1) => async (dispatch) => {
130+
export const getProjectCreatedByUser = (id = userId, pagination = 10, page = 1) => async (dispatch) => {
136131
try {
137-
console.log('getProjects userId ', userId)
132+
console.log('getProjects userId ', id)
138133
const res = await axios
139-
.get(`${BASE_URL}/project/${userId}/all?pagination=${pagination}&page=${page}`);
134+
.get(`${BASE_URL}/project/${id}/all?pagination=${pagination}&page=${page}`);
140135
dispatch(setRequestStatus(false))
141136
if(res.status === 200) {
142137
dispatch(setRequestStatus(true))
@@ -152,11 +147,11 @@ export const getProjectCreatedByUser = (userId, pagination = 10, page = 1) => as
152147
}
153148

154149
// GET POSTS CREATED BY USER
155-
export const getPostsCreatedByUser = (userId, pagination = 10, page = 1) => async (dispatch) => {
150+
export const getPostsCreatedByUser = (id = userId, pagination = 10, page = 1) => async (dispatch) => {
156151
try {
157-
console.log('getPosts userId ', userId)
152+
console.log('getPosts userId ', id)
158153
const res = await axios
159-
.get(`${BASE_URL}/post/${userId}/all?pagination=${pagination}&page=${page}`);
154+
.get(`${BASE_URL}/post/${id}/all?pagination=${pagination}&page=${page}`);
160155
dispatch(setRequestStatus(false))
161156
if(res.status === 200) {
162157
dispatch(setRequestStatus(true))
@@ -174,7 +169,7 @@ export const getPostsCreatedByUser = (userId, pagination = 10, page = 1) => asyn
174169
// GET INVITE LINK
175170
export const getInviteLink = (role) => async (dispatch) => {
176171
try {
177-
const res = await axios.get(`${BASE_URL}/user/invite?role=${role}`)
172+
const res = await axios.get(`${BASE_URL}/user/link/invite?role=${role}`)
178173
dispatch(setRequestStatus(false));
179174
if(res.status === 200) {
180175
dispatch(setRequestStatus(true));
@@ -221,9 +216,11 @@ export const activateDeactivateToggler = () => async (dispatch) => {
221216
const res = await axios.patch(`${BASE_URL}/user/deactivate/toggler`)
222217
if (res.status === 200) {
223218
console.log('Deactivation toggler', res.data);
224-
dispatch(getProfile());
219+
dispatch(getProfile(userId));
225220
}
226221
} catch (error) {
227222
dispatch(errorHandler(error))
228223
}
229-
}
224+
}
225+
226+
// GET USER'S ACTIVITY

0 commit comments

Comments
 (0)