Skip to content

Commit 640fbcd

Browse files
authored
Merge pull request #2610 from PiyushChandra17/piyush/fix-app-crash
fix crashing of app irrespective of aws s3 bucket set up
2 parents 185a0b1 + 2b3dad1 commit 640fbcd

File tree

4 files changed

+11
-31
lines changed

4 files changed

+11
-31
lines changed

client/modules/IDE/actions/collections.js

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ export function getCollections(username) {
2727
dispatch(stopLoader());
2828
})
2929
.catch((error) => {
30-
const { response } = error;
3130
dispatch({
3231
type: ActionTypes.ERROR,
33-
error: response.data
32+
error: error?.response?.data
3433
});
3534
dispatch(stopLoader());
3635
});
@@ -59,11 +58,9 @@ export function createCollection(collection) {
5958
browserHistory.push(location);
6059
})
6160
.catch((error) => {
62-
const { response } = error;
63-
console.error('Error creating collection', response.data);
6461
dispatch({
6562
type: ActionTypes.ERROR,
66-
error: response.data
63+
error: error?.response?.data
6764
});
6865
dispatch(stopLoader());
6966
});
@@ -91,14 +88,11 @@ export function addToCollection(collectionId, projectId) {
9188
return response.data;
9289
})
9390
.catch((error) => {
94-
const { response } = error;
9591
dispatch({
9692
type: ActionTypes.ERROR,
97-
error: response.data
93+
error: error?.response?.data
9894
});
9995
dispatch(stopLoader());
100-
101-
return response.data;
10296
});
10397
};
10498
}
@@ -124,14 +118,11 @@ export function removeFromCollection(collectionId, projectId) {
124118
return response.data;
125119
})
126120
.catch((error) => {
127-
const { response } = error;
128121
dispatch({
129122
type: ActionTypes.ERROR,
130-
error: response.data
123+
error: error?.response?.data
131124
});
132125
dispatch(stopLoader());
133-
134-
return response.data;
135126
});
136127
};
137128
}
@@ -149,13 +140,10 @@ export function editCollection(collectionId, { name, description }) {
149140
return response.data;
150141
})
151142
.catch((error) => {
152-
const { response } = error;
153143
dispatch({
154144
type: ActionTypes.ERROR,
155-
error: response.data
145+
error: error?.response?.data
156146
});
157-
158-
return response.data;
159147
});
160148
};
161149
}
@@ -174,13 +162,10 @@ export function deleteCollection(collectionId) {
174162
return response.data;
175163
})
176164
.catch((error) => {
177-
const { response } = error;
178165
dispatch({
179166
type: ActionTypes.ERROR,
180-
error: response.data
167+
error: error?.response?.data
181168
});
182-
183-
return response.data;
184169
});
185170
};
186171
}

client/modules/IDE/actions/preferences.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ function updatePreferences(formParams, dispatch) {
77
.put('/preferences', formParams)
88
.then(() => {})
99
.catch((error) => {
10-
const { response } = error;
1110
dispatch({
1211
type: ActionTypes.ERROR,
13-
error: response.data
12+
error: error?.response?.data
1413
});
1514
});
1615
}

client/modules/IDE/actions/project.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,9 @@ export function getProject(id, username) {
6161
dispatch(setUnsavedChanges(false));
6262
})
6363
.catch((error) => {
64-
const { response } = error;
6564
dispatch({
6665
type: ActionTypes.ERROR,
67-
error: response.data
66+
error: error?.response?.data
6867
});
6968
});
7069
};
@@ -338,10 +337,9 @@ export function cloneProject(project) {
338337
dispatch(setNewProject(response.data));
339338
})
340339
.catch((error) => {
341-
const { response } = error;
342340
dispatch({
343341
type: ActionTypes.PROJECT_SAVE_FAIL,
344-
error: response.data
342+
error: error?.response?.data
345343
});
346344
});
347345
}
@@ -376,10 +374,9 @@ export function changeProjectName(id, newName) {
376374
}
377375
})
378376
.catch((error) => {
379-
const { response } = error;
380377
dispatch({
381378
type: ActionTypes.PROJECT_SAVE_FAIL,
382-
error: response.data
379+
error: error?.response?.data
383380
});
384381
});
385382
};

client/modules/IDE/actions/projects.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ export function getProjects(username) {
2222
dispatch(stopLoader());
2323
})
2424
.catch((error) => {
25-
const { response } = error;
2625
dispatch({
2726
type: ActionTypes.ERROR,
28-
error: response.data
27+
error: error?.response?.data
2928
});
3029
dispatch(stopLoader());
3130
});

0 commit comments

Comments
 (0)