Skip to content

Commit

Permalink
Metodo para agregar puntos en services de usuarios
Browse files Browse the repository at this point in the history
  • Loading branch information
hendaniel committed Sep 6, 2020
1 parent e295928 commit efc7cbc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/api/API.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export const HISTORY = "https://coding-challenge-api.aerolab.co/user/history";
export const AUTH_TOKEN =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1ZWRkOWU5OTQ0NGZlNDAwNmRhOTkyNGQiLCJpYXQiOjE1OTE1ODIzNjF9.-f40dyUIGFsBSB_PTeBGdSLI58I21-QBJNi9wkODcKk";
export const REDEEEM = "https://coding-challenge-api.aerolab.co/redeem";
export const ADD_POINTS = "https://coding-challenge-api.aerolab.co/user/points";
13 changes: 13 additions & 0 deletions src/services/userService.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,16 @@ export const getUser = async () => {
}
};

export const addPoints = async (coins) => {
try {
const response = await fetch(API.ADD_POINTS, {
method: "POST",
body: { amount: coins },
requestHeaders,
});
const json = await response.json();
return json;
} catch (error) {
return alert(JSON.stringify(error));
}
};

0 comments on commit efc7cbc

Please sign in to comment.