Loose compare in sanitize
This commit is contained in:
parent
178059dc19
commit
ced83e862a
|
@ -31,7 +31,7 @@ async function sanitizeDiscoverParams(params) {
|
||||||
return getDiscoverOptions().then( options => {
|
return getDiscoverOptions().then( options => {
|
||||||
const getOptionValue = (optArr, value) => {
|
const getOptionValue = (optArr, value) => {
|
||||||
if (value !== undefined && optArr) {
|
if (value !== undefined && optArr) {
|
||||||
const opt = optArr.find( o => o.value === value );
|
const opt = optArr.find( o => o.value == value );
|
||||||
if (opt) {
|
if (opt) {
|
||||||
return opt.value;
|
return opt.value;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ async function sanitizeDiscoverParams(params) {
|
||||||
if (subgenreOptions) { // false if genre is 'all'
|
if (subgenreOptions) { // false if genre is 'all'
|
||||||
sanitized.subgenre = getOptionValue(subgenreOptions, params.subgenre);
|
sanitized.subgenre = getOptionValue(subgenreOptions, params.subgenre);
|
||||||
}
|
}
|
||||||
const timeAllowed = sanitized.subgenre === undefined || sanitized.subgenre === subgenreOptions[0].value;
|
const timeAllowed = sanitized.subgenre === undefined || sanitized.subgenre == subgenreOptions[0].value;
|
||||||
if (timeAllowed) {
|
if (timeAllowed) {
|
||||||
sanitized.time = getOptionValue(options.times, params.time);
|
sanitized.time = getOptionValue(options.times, params.time);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user