bad-ass-salesforce-stack
bad-ass-salesforce-stack copied to clipboard
API request don't work when VF page is displayed in lightning
When the VF page is loaded into lightning, the request stop working because the app is using ?isdtp=p1
gets to the instance url __RESTHOST__
.
Fix: update the header to remove extra junk:
const __RESTHOST__ = '{!URLFOR("/", null)}'.replace("?isdtp=p1", "");
Might want to come up with a more robust solution as there might be other URL param/values that get appended