Skip to content

Commit

Permalink
Bump version 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
João Cavalcante committed Dec 3, 2017
1 parent 40d01df commit a97258a
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
17 changes: 16 additions & 1 deletion examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,22 @@
<title>Wrappify Test</title>
</head>
<body>

<div id="albums"></div>

<script src="../dist/wrappify.js"></script>

<script>
const albums = wrappify.searchAlbums('Linkin Park');
const albumsEl = document.getElementById('albums');
albums
.then((data) => {
const markup = data.albums.items.map(item => `<img src='${item.images[0].url}' alt='${item.name}' />`)
.join('');
albumsEl.innerHTML = markup;
});
</script></script>

<script src="../dist/wrappify.umd.js"></script>
<script src="../dist/wrappify.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wrappify",
"version": "1.0.0",
"version": "1.0.1",
"description": "A javascript wrapper library to work with Spotify API.",
"main": "lib/index.js",
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions src/album.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/* global fetch */

import { API_URL } from './config';
import { API_URL, HEADERS } from './config';
import { toJSON } from './utils';

export const getAlbum = id =>
fetch(`${API_URL}/albums/${id}`)
fetch(`${API_URL}/albums/${id}`, HEADERS)
.then(toJSON);

export const getAlbums = ids =>
fetch(`${API_URL}/albums/?ids=${ids}`)
fetch(`${API_URL}/albums/?ids=${ids}`, HEADERS)
.then(toJSON);

export const getAlbumTracks = id =>
fetch(`${API_URL}/albums/${id}/tracks`)
fetch(`${API_URL}/albums/${id}/tracks`, HEADERS)
.then(toJSON);
8 changes: 8 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
const TOKEN_API = 'BQB0492MxeSRscESp31zl3lAMeJED3UHIL1r8RCEQW6NON4a3B3h-MucHikdeb0kd7h17mVw2iuw3WnwM6Ph81zASGuK0IZIzxbRUmjw2G_10BOJZni1bq6J0hC_vmB3GGtGuNsLmnfbb3E';

export const HEADERS = {
headers: {
Authorization: `Bearer ${TOKEN_API}`,
},
};

export const API_URL = 'https://api.spotify.com/v1';
4 changes: 2 additions & 2 deletions src/search.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* global fetch */

import { API_URL } from './config';
import { API_URL, HEADERS } from './config';
import { toJSON } from './utils';

export const search = (query, type) =>
fetch(`${API_URL}/search?q=${query}&type=${type}`)
fetch(`${API_URL}/search?q=${query}&type=${type}`, HEADERS)
.then(toJSON);

export const searchArtists = query => search(query, 'artist');
Expand Down

0 comments on commit a97258a

Please sign in to comment.