fix: marketplace serach bundle (#12581)
This commit is contained in:
parent
39ec6c8025
commit
71976f9192
@ -72,7 +72,7 @@ export const useMarketplacePlugins = () => {
|
||||
const handleUpdatePlugins = useCallback((pluginsSearchParams: PluginsSearchParams) => {
|
||||
mutateAsync(pluginsSearchParams).then((res) => {
|
||||
const currentPage = pluginsSearchParams.page || 1
|
||||
const resPlugins = res.data.plugins
|
||||
const resPlugins = res.data.bundles || res.data.plugins
|
||||
if (currentPage > 1) {
|
||||
setPrevPlugins(prevPlugins => [...(prevPlugins || []), ...resPlugins.map((plugin) => {
|
||||
return getFormattedPlugin(plugin)
|
||||
|
@ -110,6 +110,9 @@ export const getMarketplaceListCondition = (pluginType: string) => {
|
||||
if (pluginType === PluginType.extension)
|
||||
return 'category=endpoint'
|
||||
|
||||
if (pluginType === 'bundle')
|
||||
return 'type=bundle'
|
||||
|
||||
return ''
|
||||
}
|
||||
|
||||
|
@ -320,6 +320,7 @@ export type UninstallPluginResponse = {
|
||||
|
||||
export type PluginsFromMarketplaceResponse = {
|
||||
plugins: Plugin[]
|
||||
bundles?: Plugin[]
|
||||
total: number
|
||||
}
|
||||
export type PluginsFromMarketplaceByInfoResponse = {
|
||||
|
@ -305,7 +305,8 @@ export const useMutationPluginsFromMarketplace = () => {
|
||||
page = 1,
|
||||
pageSize = 40,
|
||||
} = pluginsSearchParams
|
||||
return postMarketplace<{ data: PluginsFromMarketplaceResponse }>('/plugins/search/basic', {
|
||||
const pluginOrBundle = type === 'bundle' ? 'bundles' : 'plugins'
|
||||
return postMarketplace<{ data: PluginsFromMarketplaceResponse }>(`/${pluginOrBundle}/search/basic`, {
|
||||
body: {
|
||||
page,
|
||||
page_size: pageSize,
|
||||
|
Loading…
Reference in New Issue
Block a user