Skip to content

Commit

Permalink
добавляет отдельный then с data
Browse files Browse the repository at this point in the history
  • Loading branch information
Suninall committed Dec 30, 2024
1 parent b4c5064 commit fc94204
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions js/interact-with-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ const getData = (onSuccess, onError) => () =>
credentials: "same-origin",
},
)
.then((response, data) => {
.then((response) => {
if (response.ok) {
return response.json();
}else{
onError("Не удалось загрузить данные. Попробуйте ещё раз");
}
onSuccess(data);

})
.then((data) => {
onSuccess(data);
})
.catch(() => {
onError("Не удалось загрузить данные. Попробуйте ещё раз");
});
Expand Down

0 comments on commit fc94204

Please sign in to comment.