fix: empty categories instead of "null" string.

With no categories selected, the value became "null", which is invalid and causes Unsplash to return any image from their library. With an empty string, the API enables all categories so Unsplash uses our collections.
This commit is contained in:
Isaac
2024-05-23 22:26:03 +01:00
parent 8bfdabdecc
commit ca6995cbca

View File

@@ -103,12 +103,12 @@ export default class Background extends PureComponent {
if (collection) {
requestURL = `${variables.constants.API_URL}/images/unsplash?collections=${collection}&quality=${apiQuality}`;
} else {
requestURL = `${variables.constants.API_URL}/images/unsplash?categories=${apiCategories}&quality=${apiQuality}`;
requestURL = `${variables.constants.API_URL}/images/unsplash?categories=${apiCategories || ''}&quality=${apiQuality}`;
}
break;
// Defaults to Mue
default:
requestURL = `${variables.constants.API_URL}/images/random?categories=${apiCategories}&quality=${apiQuality}&excludes=${backgroundExclude}`;
requestURL = `${variables.constants.API_URL}/images/random?categories=${apiCategories || ''}&quality=${apiQuality}&excludes=${backgroundExclude}`;
break;
}