Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2021
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   let nextUrl = 'https://api.wanikani.com/v2/subjects?types=kanji';
  2.   let results = [];
  3.   while (nextUrl) {
  4.     const response = await fetch(nextUrl, {
  5.       method: 'GET',
  6.       headers: { Authorization: `Bearer ${API_TOKEN}` },
  7.     });
  8.     const body = await response.json();
  9.     nextUrl = body.pages.next_url;
  10.     results.push(...body.data);
  11.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement