mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
selected exported from discover state hook
This commit is contained in:
parent
fec92c2957
commit
c384d73536
1 changed files with 3 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ const { useServices } = require('stremio/services');
|
|||
const { CONSTANTS, useModelState, comparatorWithPriorities } = require('stremio/common');
|
||||
|
||||
const initDiscoverState = () => ({
|
||||
selected: null,
|
||||
selectable: {
|
||||
types: [],
|
||||
catalogs: [],
|
||||
|
|
@ -14,6 +15,7 @@ const initDiscoverState = () => ({
|
|||
});
|
||||
|
||||
const mapDiscoverState = (discover) => {
|
||||
const selected = discover.selected;
|
||||
const selectable = {
|
||||
types: discover.selectable.types.sort((t1, t2) => {
|
||||
return comparatorWithPriorities(CONSTANTS.TYPE_PRIORITIES)(t1.name, t2.name);
|
||||
|
|
@ -45,7 +47,7 @@ const mapDiscoverState = (discover) => {
|
|||
}
|
||||
:
|
||||
discover.catalog_resource;
|
||||
return { selectable, catalog_resource };
|
||||
return { selected, selectable, catalog_resource };
|
||||
};
|
||||
|
||||
const onNewDiscoverState = (discover) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue