Skip to content
Snippets Groups Projects
Commit 88afb9f3 authored by Barnabás Czémán's avatar Barnabás Czémán
Browse files

catch errors

parent e045cd1e
Branches
Tags
No related merge requests found
...@@ -10,6 +10,7 @@ const axios = ax.create({ ...@@ -10,6 +10,7 @@ const axios = ax.create({
export const getUserData = () => ( export const getUserData = () => (
async (dispatch) => { async (dispatch) => {
try {
const user = await axios.get('/api/v1/profiles/me'); const user = await axios.get('/api/v1/profiles/me');
const { const {
id, id,
...@@ -27,17 +28,19 @@ export const getUserData = () => ( ...@@ -27,17 +28,19 @@ export const getUserData = () => (
id, joinDate, nick, motivationAbout, motivationProfession, motivationExercise, signed, groups, id, joinDate, nick, motivationAbout, motivationProfession, motivationExercise, signed, groups,
}, },
}); });
} catch (e) {}
} }
); );
export const getNews = () => ( export const getNews = () => (
async (dispatch) => { async (dispatch) => {
try {
const response = await axios.get('/api/v1/news'); const response = await axios.get('/api/v1/news');
if(response) {
dispatch({ dispatch({
type: GET_NEWS, type: GET_NEWS,
payload: response.data, payload: response.data,
}); });
} catch(e) {
} }
} }
...@@ -57,6 +60,7 @@ export const submitRegistration = ({ ...@@ -57,6 +60,7 @@ export const submitRegistration = ({
nick, groups, signed, motivationAbout, motivationProfession, motivationExercise, id, nick, groups, signed, motivationAbout, motivationProfession, motivationExercise, id,
}) => ( }) => (
async (dispatch) => { async (dispatch) => {
try {
const response = await axios.patch(`/api/v1/profiles/${id}/`, { const response = await axios.patch(`/api/v1/profiles/${id}/`, {
nick, nick,
groups, groups,
...@@ -70,5 +74,6 @@ export const submitRegistration = ({ ...@@ -70,5 +74,6 @@ export const submitRegistration = ({
} else { } else {
alert('Mentés nem sikerült!'); alert('Mentés nem sikerült!');
} }
} catch(e) {}
} }
); );
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment