Skip to content

Commit c57ef6f

Browse files
Merge branch 'development' into account-page
2 parents ffa02e6 + 3d03c8c commit c57ef6f

File tree

111 files changed

+824
-608
lines changed

Some content is hidden

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

111 files changed

+824
-608
lines changed

src/actions/authAction.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import jwt_decode from 'jwt-decode';
55
import { errorHandler } from '../utils/errorHandler';
66
import { setRequestStatus } from '../utils/setRequestStatus';
77
import { BASE_URL } from './baseApi';
8+
import { customErrorHandler } from '../utils/customErrorHandler'
89
let forgotPasswordToken = "";
910

1011
// to register user
@@ -23,6 +24,7 @@ export const registerUser = (userInfo, history) => async (dispatch) => {
2324
}
2425

2526
} catch(error) {
27+
console.log('register error ', error)
2628
dispatch(errorHandler(error));
2729
}
2830
}
@@ -62,7 +64,8 @@ export const loginUser = (userInfo, history) => async (dispatch) => {
6264
history.push("/dashboard");
6365
}
6466
} catch(error) {
65-
dispatch(errorHandler(error));
67+
console.log('login error ', error?.response)
68+
dispatch(customErrorHandler(error?.response?.data || ""));
6669
}
6770
}
6871

@@ -140,4 +143,4 @@ export const setCurrentUser = (decodedData) => {
140143
type: SET_CURRENT_USER,
141144
payload: decodedData
142145
}
143-
}
146+
}

src/actions/insightAction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const getOrgOverview = () => async (dispatch) => {
2525
// GET PERSONAL OVERVIEW
2626
export const getPersonalOverview = () => async (dispatch) => {
2727
try {
28-
const res = await axios.get(`${BASE_URL}/user/overview`)
28+
const res = await axios.get(`${BASE_URL}/user/me/overview`)
2929
dispatch(setRequestStatus(false))
3030
if (res.status === 200) {
3131
dispatch(setRequestStatus(true))

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/actions/types.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@ 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"

src/actions/usersAction.js

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
import { GET_USER_PROFILE, GET_ALL_MEMBERS, UPDATE_USER_PROFILE, GET_USER_EVENTS, GET_USER_PROJECTS, GET_USER_POSTS, GET_INVITE_LINK, PROCESS_INVITE_LINK, SET_ADMIN } from './types'
1+
import { GET_USER_PROFILE, GET_ALL_MEMBERS, UPDATE_USER_PROFILE, GET_USER_EVENTS, GET_USER_PROJECTS, GET_USER_POSTS, GET_INVITE_LINK, PROCESS_INVITE_LINK, SET_ADMIN, CLEAR_INVITE_LINK } from './types'
22
import { errorHandler } from '../utils/errorHandler'
33
import axios from 'axios'
44
import { setRequestStatus } from '../utils/setRequestStatus'
55
import { BASE_URL } from './baseApi'
66

77
// GET USER PROFILE
8-
export const getProfile = () => async (dispatch)=> {
8+
export const getProfile = (id) => async (dispatch)=> {
99
try {
10-
const res = await axios.get(`${BASE_URL}/user/me`)
11-
dispatch(setRequestStatus(false))
10+
console.log('getProfile userId ',id)
11+
const res = await axios.get(`${BASE_URL}/user/${id}`)
1212
if (res.status === 200) {
13-
setRequestStatus(true)
1413
console.log('user profile ', res.data)
1514
dispatch({
1615
type: GET_USER_PROFILE,
@@ -95,13 +94,12 @@ export const removeUser = (userId) => async (dispatch) => {
9594
}
9695

9796
// UPDATE USER PROFILE
98-
export const updateProfile = (updatedInfo) => async (dispatch) => {
97+
export const updateProfile = (userId, updatedInfo) => async (dispatch) => {
9998
try {
99+
console.log('updateProfile userId ', userId)
100100
console.log('updating ', updatedInfo)
101-
const res = await axios.patch(`${BASE_URL}/user/me`, updatedInfo)
102-
dispatch(setRequestStatus(false))
101+
const res = await axios.patch(`${BASE_URL}/user/${userId}`, updatedInfo)
103102
if(res.status === 200) {
104-
dispatch(setRequestStatus(true))
105103
console.log('user profile updated ', res.data)
106104
dispatch({
107105
type: UPDATE_USER_PROFILE,
@@ -114,9 +112,11 @@ export const updateProfile = (updatedInfo) => async (dispatch) => {
114112
}
115113

116114
// GET EVENTS CREATED BY USER
117-
export const getEventsCreatedByUser = (pagination = 10, page = 1) => async (dispatch) => {
115+
export const getEventsCreatedByUser = (userId, pagination = 10, page = 1) => async (dispatch) => {
118116
try {
119-
const res = await axios.get(`${BASE_URL}/event/me/all?pagination=${pagination}&page=${page}`);
117+
console.log('getEvents userId ', userId)
118+
const res = await axios
119+
.get(`${BASE_URL}/event/${userId}/all?pagination=${pagination}&page=${page}`);
120120
dispatch(setRequestStatus(false))
121121
if(res.status === 200) {
122122
dispatch(setRequestStatus(true))
@@ -132,9 +132,11 @@ export const getEventsCreatedByUser = (pagination = 10, page = 1) => async (disp
132132
}
133133

134134
// GET ALL PROJECT CREATED BY A USER
135-
export const getProjectCreatedByUser = (pagination = 10, page = 1) => async (dispatch) => {
135+
export const getProjectCreatedByUser = (userId, pagination = 10, page = 1) => async (dispatch) => {
136136
try {
137-
const res = await axios.get(`${BASE_URL}/project/me/all?pagination=${pagination}&page=${page}`);
137+
console.log('getProjects userId ', userId)
138+
const res = await axios
139+
.get(`${BASE_URL}/project/${userId}/all?pagination=${pagination}&page=${page}`);
138140
dispatch(setRequestStatus(false))
139141
if(res.status === 200) {
140142
dispatch(setRequestStatus(true))
@@ -150,9 +152,11 @@ export const getProjectCreatedByUser = (pagination = 10, page = 1) => async (dis
150152
}
151153

152154
// GET POSTS CREATED BY USER
153-
export const getPostsCreatedByUser = (pagination = 10, page = 1) => async (dispatch) => {
155+
export const getPostsCreatedByUser = (userId, pagination = 10, page = 1) => async (dispatch) => {
154156
try {
155-
const res = await axios.get(`${BASE_URL}/post/me/all?pagination=${pagination}&page=${page}`);
157+
console.log('getPosts userId ', userId)
158+
const res = await axios
159+
.get(`${BASE_URL}/post/${userId}/all?pagination=${pagination}&page=${page}`);
156160
dispatch(setRequestStatus(false))
157161
if(res.status === 200) {
158162
dispatch(setRequestStatus(true))
@@ -203,6 +207,14 @@ export const processInviteToken = (token) => async (dispatch) => {
203207
}
204208
}
205209

210+
// CLEAR INVITE LINK
211+
export const clearInviteLink = () => async (dispatch) => {
212+
dispatch({
213+
type: CLEAR_INVITE_LINK,
214+
payload: ''
215+
})
216+
}
217+
206218
// ACTIVATE DEACTIVATE TOGGLER
207219
export const activateDeactivateToggler = () => async (dispatch) => {
208220
try {
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)