From 0f20fe691fb996cba17c85f8596ad4c9debc26ec Mon Sep 17 00:00:00 2001 From: AAGaming Date: Wed, 1 Jun 2022 17:55:49 -0400 Subject: fix oops --- frontend/src/plugin-loader.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 }; -- cgit v1.2.3