use-listen-along
Advanced tools
Comparing version 1.1.4 to 1.1.5
@@ -19,2 +19,6 @@ 'use strict'; | ||
console.log({ | ||
status: !res.success, | ||
message: res.error.message | ||
}); | ||
var error = { | ||
@@ -21,0 +25,0 @@ status: !res.success, |
@@ -1,2 +0,2 @@ | ||
"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}}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useListenAlong=function(t,e,r){var s,n=!1,o=null,a=function(t){var e,r;return console.log({status:!t.success,message:t.error.message}),{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!==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,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)})),s=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:n,error:o}}; | ||
//# sourceMappingURL=use-listen-along.cjs.production.min.js.map |
@@ -15,2 +15,6 @@ /** | ||
console.log({ | ||
status: !res.success, | ||
message: res.error.message | ||
}); | ||
var error = { | ||
@@ -17,0 +21,0 @@ status: !res.success, |
{ | ||
"name": "use-listen-along", | ||
"description": "A react hook to listen alongside others on spotify.", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "main": "dist/index.js", |
@@ -20,2 +20,3 @@ import { LanyardResponse } from './types'; | ||
const parseResponse = (res: LanyardResponse) => { | ||
console.log({ status: !res.success, message: res.error.message }); | ||
const error = { status: !res.success, message: res.error.message }; | ||
@@ -22,0 +23,0 @@ const np = res.data.listening_to_spotify; |
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
25371
362