mirror of
https://github.com/dbgate/dbgate
synced 2024-11-08 04:35:58 +00:00
usePlugins
This commit is contained in:
parent
e14165c403
commit
8ab8034060
@ -38,3 +38,15 @@ export default function PluginsProvider({ children }) {
|
||||
}, [installedPlugins]);
|
||||
return <PluginsContext.Provider value={plugins}>{children}</PluginsContext.Provider>;
|
||||
}
|
||||
|
||||
export function usePlugins() {
|
||||
const installed = useInstalledPlugins();
|
||||
const loaded = React.useContext(PluginsContext);
|
||||
return installed
|
||||
.map((manifest) => ({
|
||||
packageName: manifest.name,
|
||||
manifest,
|
||||
content: loaded[manifest.name],
|
||||
}))
|
||||
.filter((x) => x.content);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user