Plugin marketplace for flipper-server-core
Summary: Implementation taken from: https://www.internalfb.com/code/fbsource/[85c1fe5afee7]/xplat/sonar/desktop/flipper-ui-core/src/fb/pluginMarketplaceAPI.tsx As with the previous diff, the marketplace API for flipper-server-core accesses the existing config in a different way and depends on FlipperServer, instead of User, to execute intern request as to obtain marketplace plugins. Reviewed By: passy Differential Revision: D37749775 fbshipit-source-id: 968ea3f7a412893f032e5a7a50ecf17c298e18ff
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ff66cd18ec
commit
beb0ed1991
@@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*
|
||||||
|
* @format
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {FlipperServer, MarketplacePluginDetails} from 'flipper-common';
|
||||||
|
|
||||||
|
export async function loadAvailablePlugins(
|
||||||
|
server: FlipperServer,
|
||||||
|
marketplaceURL: string,
|
||||||
|
): Promise<MarketplacePluginDetails[]> {
|
||||||
|
try {
|
||||||
|
const response = await fetch(marketplaceURL);
|
||||||
|
const plugins = await response.json();
|
||||||
|
return plugins;
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Failed while retrieving marketplace plugins', e);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user