use-listen-along
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -33,3 +33,3 @@ 'use strict'; | ||
var setResponse = function setResponse(r) { | ||
if (r.error.status) throw new Error(r.error.message); | ||
if (r.error.status) throw new Error(JSON.stringify(r.error)); | ||
@@ -36,0 +36,0 @@ if (r.track !== track && r.np && !disconnect) { |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useListenAlong=function(t,e,r){var s,n=!1,a=null,o=function(t){var e,r;return{error:{status:!t.success,message:t.error.message},np:t.data.listening_to_spotify,track:null==(e=t.data)||null==(r=e.spotify)?void 0:r.track_id}},i=function(t){if(t.error.status)throw new Error(t.error.message);t.track!==s&&t.np&&!r&&fetch("https://api.spotify.com/v1/me/player/play",{method:"PUT",headers:{Authorization:"Bearer "+e,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({uris:["spotify:track:"+s]})}).then((function(t){n=204==t.status,a=204!==t.status?403==t.status?"User must have a premium account.":t.statusText:null})).catch((function(t){if(t.status)throw new Error(t)})),s=t.track};return setInterval((function(){r||fetch("https://api.lanyard.rest/v1/users/"+t).then((function(t){return t.json()})).then(o).then(i)}),1e3),{connected:n,error:a}}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useListenAlong=function(t,e,r){var n,s=!1,o=null,a=function(t){var e,r;return{error:{status:!t.success,message:t.error.message},np:t.data.listening_to_spotify,track:null==(e=t.data)||null==(r=e.spotify)?void 0:r.track_id}},i=function(t){if(t.error.status)throw new Error(JSON.stringify(t.error));t.track!==n&&t.np&&!r&&fetch("https://api.spotify.com/v1/me/player/play",{method:"PUT",headers:{Authorization:"Bearer "+e,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({uris:["spotify:track:"+n]})}).then((function(t){s=204==t.status,o=204!==t.status?403==t.status?"User must have a premium account.":t.statusText:null})).catch((function(t){if(t.status)throw new Error(t)})),n=t.track};return setInterval((function(){r||fetch("https://api.lanyard.rest/v1/users/"+t).then((function(t){return t.json()})).then(a).then(i)}),1e3),{connected:s,error:o}}; | ||
//# sourceMappingURL=use-listen-along.cjs.production.min.js.map |
@@ -29,3 +29,3 @@ /** | ||
var setResponse = function setResponse(r) { | ||
if (r.error.status) throw new Error(r.error.message); | ||
if (r.error.status) throw new Error(JSON.stringify(r.error)); | ||
@@ -32,0 +32,0 @@ if (r.track !== track && r.np && !disconnect) { |
{ | ||
"name": "use-listen-along", | ||
"description": "A react hook to listen alongside others on spotify.", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "main": "dist/index.js", |
@@ -36,3 +36,3 @@ import { LanyardResponse } from './types'; | ||
}) => { | ||
if (r.error.status) throw new Error(r.error.message); | ||
if (r.error.status) throw new Error(JSON.stringify(r.error)); | ||
@@ -39,0 +39,0 @@ if (r.track !== track && r.np && !disconnect) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24460