Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const url = 'https://random-data-api.com/api/stripe/random_stripe'
- const getData = async () => {
- let info = new Promise((resolve,reject) => {
- return fetch(url).then(response => {
- response.json()
- }).then(json => {
- resolve()
- return json
- }).catch(err => {
- console.log(err);
- })
- })
- info.then((data)=> {return {data}})
- }
- console.log(getData());
- fetch(url).then(response => {
- response.json()
- }).then(json => {
- console.log(json);
- }).catch(err => {
- console.log(err);
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement