Skip to content

Commit

Permalink
Stringify de request en servicios
Browse files Browse the repository at this point in the history
  • Loading branch information
hendaniel committed Sep 6, 2020
1 parent ed11ec9 commit 33151b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/services/productsService.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ export const getProducts = async () => {

export const redeemProduct = async (id) => {
try {
console.log(id);
const response = await fetch(API.REDEEEM, {
method: "POST",
body: { productId: id },
headers,
method: "POST",
body: JSON.stringify({ productId: id }),
});
console.log("request", response);
const json = await response.json();
return json;
} catch (error) {
console.log("errrooor", error);
console.log("Error", error);
return alert(JSON.stringify(error));
}
};
2 changes: 1 addition & 1 deletion src/services/userService.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const addPoints = async (coins) => {
try {
const response = await fetch(API.ADD_POINTS, {
method: "POST",
body: { amount: coins },
body: JSON.stringify({ amount: coins }),
headers,
});
const json = await response.json();
Expand Down

0 comments on commit 33151b1

Please sign in to comment.