code refactor in DeepLinkHandler

This commit is contained in:
nklhrstv 2022-10-19 14:55:28 +03:00
parent 5fb1022336
commit 3c28f671c5

View file

@ -4,10 +4,13 @@ const { withCoreSuspender, useStreamingServer } = require('stremio/common');
const DeepLinkHandler = () => {
const streamingServer = useStreamingServer();
React.useEffect(() => {
if (streamingServer.torrent && streamingServer.torrent[1].type === 'Ready') {
const [_, deepLinks] = streamingServer.torrent[1].content;
if (typeof deepLinks.metaDetailsVideos === 'string') {
window.location = deepLinks.metaDetailsVideos;
if (streamingServer.torrent !== null) {
const [, { type, content }] = streamingServer.torrent;
if (type === 'Ready') {
const [, deepLinks] = content;
if (typeof deepLinks.metaDetailsVideos === 'string') {
window.location = deepLinks.metaDetailsVideos;
}
}
}
}, [streamingServer.torrent]);