@Panda said in Interesting Widget code, but canāt fetch API:
How did you drop that widget into the post there?
I hadnt seen this BSgenerator anywhere on sudonix site, do you use it somewhere already?
Yes, here
https://sudonix.org/topic/414/corporate-bullshit-generator?_=1687774393044
Itās not a āpostā or ātopicā in the common sense. It is actually a page in itās own right and leverages nodebb-plugin-custom-pages. This in turn creates a new ārouteā which behaves like a page, meaning it is then exposed for widgets.
@Panda said in Interesting Widget code, but canāt fetch API:
Also can you explain more what you mean by calling the code externally. In my API call example, how would I go about doing that?
By this, I mean create all the required code in an external JS file that is reachable by the NodeBB instance - so, in āpublicā for example - or in my case /public/js. The widget then ācallsā that file and because it runs outside of the scope of NodeBB, you just need to return the values to the widget.
Hope this makes sense?