Plugin backend reload (#463)

Co-authored-by: beebls <102569435+beebls@users.noreply.github.com>
This commit is contained in:
suchmememanyskill
2023-06-02 03:44:55 +02:00
committed by GitHub
parent 8049417e03
commit 2e8e0fc7c1
2 changed files with 30 additions and 5 deletions

View File

@@ -44,7 +44,23 @@ function PluginInteractables(props: { entry: ReorderableEntry<PluginData> }) {
const showCtxMenu = (e: MouseEvent | GamepadEvent) => {
showContextMenu(
<Menu label={t('PluginListIndex.plugin_actions')}>
<MenuItem onSelected={() => window.DeckyPluginLoader.importPlugin(pluginName, data?.version)}>
<MenuItem
onSelected={() => {
try {
fetch(`http://127.0.0.1:1337/plugins/${pluginName}/reload`, {
method: 'POST',
credentials: 'include',
headers: {
Authentication: window.deckyAuthToken,
},
});
} catch (err) {
console.error('Error Reloading Plugin Backend', err);
}
window.DeckyPluginLoader.importPlugin(pluginName, data?.version);
}}
>
{t('PluginListIndex.reload')}
</MenuItem>
<MenuItem