SKIP_EXTRA_NAME added to constants

This commit is contained in:
nklhrstv 2020-03-27 11:33:16 +02:00
parent 5e703517f8
commit 8bb1687fb4
2 changed files with 7 additions and 5 deletions

View file

@ -3,11 +3,13 @@ const SUBTITLES_FONTS = ['Roboto', 'Arial', 'Halvetica', 'Times New Roman', 'Ver
const CATALOG_PREVIEW_SIZE = 10;
const CATALOG_PAGE_SIZE = 100;
const NONE_EXTRA_VALUE = 'None';
const SKIP_EXTRA_NAME = 'skip';
module.exports = {
SUBTITLES_SIZES,
SUBTITLES_FONTS,
CATALOG_PREVIEW_SIZE,
CATALOG_PAGE_SIZE,
NONE_EXTRA_VALUE
NONE_EXTRA_VALUE,
SKIP_EXTRA_NAME
};

View file

@ -1,8 +1,8 @@
const React = require('react');
const { CONSTANTS } = require('stremio/common');
const SKIP_EXTRA = {
name: 'skip',
const SKIP_EXTRA_PROP = {
name: CONSTANTS.SKIP_EXTRA_NAME,
optionsLimit: 1,
isRequired: false
};
@ -65,7 +65,7 @@ const mapSelectableInputs = (discover) => {
}
};
const requestedPage = selectedCatalogRequest.path.extra.reduce((requestedPage, [name, value]) => {
if (name === SKIP_EXTRA.name) {
if (name === CONSTANTS.SKIP_EXTRA_NAME) {
const skip = parseInt(value);
if (isFinite(skip)) {
return Math.floor(skip / CONSTANTS.CATALOG_PAGE_SIZE) + 1;
@ -162,7 +162,7 @@ const mapSelectableInputs = (discover) => {
resource: 'catalog',
type_name: selectedCatalogRequest.path.type_name,
id: selectedCatalogRequest.path.id,
extra: getNextExtra(selectedCatalogRequest.path.extra, SKIP_EXTRA, nextValue)
extra: getNextExtra(selectedCatalogRequest.path.extra, SKIP_EXTRA_PROP, nextValue)
}
});
}