Skip to content

Commit

Permalink
Get products from api using fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
ebenezerdon committed Nov 10, 2018
1 parent a109399 commit afba8f4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions UI/assets/js/products.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
getProducts = () => {
const options = {
headers: new Headers({
'Content-Type': 'application/json',
'accessstoken': localStorage.accesstoken,
}),
};
fetch('https://newstoremanager.herokuapp.com/api/v1/products', options)
.then(res => res.json())
.then((data) => {
let output = '<h2>Products</h2>';
console.log(data);
});
console.log(localStorage.accesstoken);
};

0 comments on commit afba8f4

Please sign in to comment.