diff options
| author | AAGaming <aa@bigdumb.gq> | 2022-06-01 17:55:49 -0400 |
|---|---|---|
| committer | AAGaming <aa@bigdumb.gq> | 2022-06-01 17:55:49 -0400 |
| commit | 0f20fe691fb996cba17c85f8596ad4c9debc26ec (patch) | |
| tree | 597ab53248176cd05dc04284c56166c973db3815 | |
| parent | 86e23686aacccfe22a24e1d63c57f037b7ce2a4d (diff) | |
| download | decky-loader-0f20fe691fb996cba17c85f8596ad4c9debc26ec.tar.gz decky-loader-0f20fe691fb996cba17c85f8596ad4c9debc26ec.zip | |
fix oops
| -rw-r--r-- | frontend/src/plugin-loader.tsx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/frontend/src/plugin-loader.tsx b/frontend/src/plugin-loader.tsx index 0c62ad5d..bdefc0b6 100644 --- a/frontend/src/plugin-loader.tsx +++ b/frontend/src/plugin-loader.tsx @@ -118,6 +118,19 @@ class PluginLoader extends Logger { return { routerHook: this.routerHook, callServerMethod: this.callServerMethod, + async callPluginMethod(methodName: string, args = {}) { + const response = await fetch(`http://127.0.0.1:1337/plugins/${pluginName}/methods/${methodName}`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + args, + }), + }); + + return response.json(); + }, fetchNoCors(url: string, request: any = {}) { let args = { method: 'POST', headers: {}, body: '' }; const req = { ...args, ...request, url, data: request.body }; |
