@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?