Service worker caching, Loader component
This commit is contained in:
@ -20,7 +20,7 @@ export function set(data) {
|
||||
* @param data mixed = request payload
|
||||
* @return Promise
|
||||
* */
|
||||
const sendRequest = (dispatch, getState, endpoint, method = 'GET', data = false) => new Promise((resolve, reject) => {
|
||||
const sendRequest = (dispatch, getState, endpoint, method = 'GET', data = false) => new Promise((resolve, reject) => {
|
||||
if (endpoint.startsWith('https://') || endpoint.startsWith('http://')) {
|
||||
var url = endpoint;
|
||||
} else {
|
||||
@ -135,7 +135,7 @@ export function getMe() {
|
||||
* @param path = String, the relative API path for the HTML lyrics
|
||||
* */
|
||||
export function getTrackLyrics(uri, path) {
|
||||
return (dispatch, getState) => {
|
||||
return (dispatch, getState) => {
|
||||
dispatch(coreActions.trackLoaded({
|
||||
uri,
|
||||
lyrics: null,
|
||||
@ -160,7 +160,7 @@ export function getTrackLyrics(uri, path) {
|
||||
if (response && response.result) {
|
||||
const html = $(response.result);
|
||||
let lyrics = html.find('.lyrics');
|
||||
if (lyrics.length > 0) {
|
||||
if (lyrics.length > 0) {
|
||||
lyrics = lyrics.first();
|
||||
lyrics.find('a').replaceWith(function () {
|
||||
return this.innerHTML;
|
||||
@ -181,7 +181,7 @@ export function getTrackLyrics(uri, path) {
|
||||
'Could not get track lyrics',
|
||||
response.error,
|
||||
));
|
||||
}
|
||||
}
|
||||
},
|
||||
(xhr, status, error) => {
|
||||
dispatch(uiActions.stopLoading(loader_key));
|
||||
@ -195,7 +195,7 @@ export function getTrackLyrics(uri, path) {
|
||||
}
|
||||
|
||||
export function findTrackLyrics(track) {
|
||||
return (dispatch, getState) => {
|
||||
return (dispatch, getState) => {
|
||||
let query = '';
|
||||
query += `${track.artists[0].name} `;
|
||||
query += track.name;
|
||||
|
||||
Reference in New Issue
Block a user