Skip to content

Commit

Permalink
Update photo API endpoint and make network error not to block renderi…
Browse files Browse the repository at this point in the history
…ng (#33)
  • Loading branch information
dwi2 authored Aug 4, 2019
1 parent 419af2c commit 8640a45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/services/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export const getPhotos = () => dispatch => {
if (res.ok) {
return res.json();
}
throw new Error(res.statusText);
console.warn(`${res.statusText} from ${API_HOST}${END_POINTS.PHOTO}`);
return;
})
.then(data => {
dispatch({
Expand Down
7 changes: 4 additions & 3 deletions src/services/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export const ACTION_TYPES = {
CREATE_PHOTO_ADD_MEMBER: "CREATE_PHOTO_ADD_MEMBER",
CREATE_PHOTO_DEL_MEMBER: "CREATE_PHOTO_DEL_MEMBER",
CREATE_PHOTO_TYPE_NUMBER: "CREATE_PHOTO_TYPE_NUMBER",
CREATE_PHOTO_TYPE_CURR_SELECTED_MEM_TYPE: "CREATE_PHOTO_TYPE_CURR_SELECTED_MEM_TYPE",
CREATE_PHOTO_TYPE_CURR_SELECTED_MEM_TYPE:
"CREATE_PHOTO_TYPE_CURR_SELECTED_MEM_TYPE"
};

export const STORE_TYPES = {
Expand All @@ -23,11 +24,11 @@ export const STORE_TYPES = {
COSTUME: "costume",
MEMBER: "member",
NUMBER: "number",
CURR_SELECTED_MEM_TYPE: "curr_selected_member_type",
CURR_SELECTED_MEM_TYPE: "curr_selected_member_type"
}
}
};

export const END_POINTS = {
PHOTO: "/photos/all"
PHOTO: "/photo"
};

0 comments on commit 8640a45

Please sign in to comment.