Skip to content

Commit 24e45a6

Browse files
committed
Merge pull request #1 from mathbruyen/patch-1
Use async/await for pokemon-client
2 parents 6dfd7cd + be04e78 commit 24e45a6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pokemon-client.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import fetch from 'node-fetch';
22

33
const BASE_API = 'http://pokeapi.co';
44

5-
export function pokemon({id = 1} = {}){
6-
return fetch(`${BASE_API}/api/v1/pokemon/${id}`)
7-
.then((response) => response.json());
5+
export async function pokemon({id = 1} = {}){
6+
var response = await fetch(`${BASE_API}/api/v1/pokemon/${id}`);
7+
return response.json();
88
};
99

1010
export async function descriptions({pokemon = false} = {}){

0 commit comments

Comments
 (0)