mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
feat: load model
This commit is contained in:
parent
c70211153e
commit
a9d9c8d808
1 changed files with 20 additions and 1 deletions
|
|
@ -41,12 +41,31 @@ const Discover = ({ urlParams, queryParams }) => {
|
|||
}
|
||||
}, [hasNextPage, loadNextPage]);
|
||||
const selectedMetaItem = React.useMemo(() => {
|
||||
return discover.catalog !== null &&
|
||||
const item = discover.catalog !== null &&
|
||||
discover.catalog.content.type === 'Ready' &&
|
||||
discover.catalog.content.content[selectedMetaItemIndex] ?
|
||||
discover.catalog.content.content[selectedMetaItemIndex]
|
||||
:
|
||||
null;
|
||||
|
||||
if (item !== null) {
|
||||
core.transport.dispatch({
|
||||
action: 'Load',
|
||||
args: {
|
||||
model: 'MetaDetails',
|
||||
args: {
|
||||
metaPath: {
|
||||
resource: 'meta',
|
||||
type: item.type,
|
||||
id: item.id,
|
||||
extra: []
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return item;
|
||||
}, [discover.catalog, selectedMetaItemIndex]);
|
||||
const addToLibrary = React.useCallback(() => {
|
||||
if (selectedMetaItem === null) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue