From be04e787f43b62403a33d8f040c96df94de8dc38 Mon Sep 17 00:00:00 2001 From: Mathieu Bruyen Date: Mon, 13 Jul 2015 14:54:53 +0200 Subject: [PATCH] Use async/await for pokemon-client --- pokemon-client.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pokemon-client.js b/pokemon-client.js index e4bca99..faca731 100644 --- a/pokemon-client.js +++ b/pokemon-client.js @@ -2,9 +2,9 @@ import fetch from 'node-fetch'; const BASE_API = 'http://pokeapi.co'; -export function pokemon({id = 1} = {}){ - return fetch(`${BASE_API}/api/v1/pokemon/${id}`) - .then((response) => response.json()); +export async function pokemon({id = 1} = {}){ + var response = await fetch(`${BASE_API}/api/v1/pokemon/${id}`); + return response.json(); }; export async function descriptions({pokemon = false} = {}){