From ca6995cbca77aab33c73e910e04683cbc99e9c69 Mon Sep 17 00:00:00 2001 From: Isaac Date: Thu, 23 May 2024 22:26:03 +0100 Subject: [PATCH] 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. --- src/features/background/Background.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/features/background/Background.jsx b/src/features/background/Background.jsx index 34d0c224..5d6b2bc8 100644 --- a/src/features/background/Background.jsx +++ b/src/features/background/Background.jsx @@ -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; }