improved error handling

This commit is contained in:
Hayden 2021-01-03 12:09:10 -09:00
parent a0acfdbc8f
commit abd605918d
2 changed files with 5 additions and 7 deletions

View file

@ -19,9 +19,8 @@ const apiReq = {
post: async function(url, data) {
let response = await axios.post(url, data).catch(function(error) {
if (error.response) {
console.log("Error");
processResponse(error.response);
return;
return error.response;
}
});
processResponse(response);
@ -32,7 +31,7 @@ const apiReq = {
let response = await axios.get(url, data).catch(function(error) {
if (error.response) {
processResponse(error.response);
return;
return response;
} else return;
});
// processResponse(response);
@ -43,7 +42,7 @@ const apiReq = {
let response = await axios.delete(url, data).catch(function(error) {
if (error.response) {
processResponse(error.response);
return;
return response;
}
});
processResponse(response);

View file

@ -23,10 +23,9 @@ export default {
let response = await apiReq.post(recipeURLs.createByURL, {
url: recipeURL,
});
console.log(response);
let recipeSlug = response.data;
store.dispatch("requestRecentRecipes");
router.push(`/recipe/${recipeSlug}`);
return response;
},
async create(recipeData) {