Fix: fix custom quicklaunch search without search widget (#5003)

pull/4985/head
shamoon 1 month ago committed by GitHub
parent 5ea46881ee
commit 5f19e4af91
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,5 +1,6 @@
import { searchProviders } from "components/widgets/search/search";
import { getSettings } from "utils/config/config";
import cachedFetch from "utils/proxy/cached-fetch";
import { widgetsFromConfig } from "utils/config/widget-helpers";
@ -12,8 +13,16 @@ export default async function handler(req, res) {
const widgets = await widgetsFromConfig();
const searchWidget = widgets.find((w) => w.type === "search");
provider.url = searchWidget.options.url;
provider.suggestionUrl = searchWidget.options.suggestionUrl;
if (searchWidget) {
provider.url = searchWidget.options.url;
provider.suggestionUrl = searchWidget.options.suggestionUrl;
} else {
const settings = getSettings();
if (settings.quicklaunch && settings.quicklaunch.provider === "custom") {
provider.url = settings.quicklaunch.url;
provider.suggestionUrl = settings.quicklaunch.suggestionUrl;
}
}
}
if (!provider.suggestionUrl) {

Loading…
Cancel
Save