diff --git a/corehq/apps/cloudcare/static/cloudcare/js/formplayer/main.js b/corehq/apps/cloudcare/static/cloudcare/js/formplayer/main.js index fc8a83a82bfb..007803800afa 100644 --- a/corehq/apps/cloudcare/static/cloudcare/js/formplayer/main.js +++ b/corehq/apps/cloudcare/static/cloudcare/js/formplayer/main.js @@ -10,7 +10,7 @@ hqDefine("cloudcare/js/formplayer/main", [ FormplayerFrontEnd, sentry ) { - $(function () { + $(async function () { sentry.initSentry(); window.MAPBOX_ACCESS_TOKEN = initialPageData.get('mapbox_access_token'); // maps api is loaded on-demand @@ -24,6 +24,7 @@ hqDefine("cloudcare/js/formplayer/main", [ singleAppMode: false, environment: initialPageData.get('environment'), }; + await FormplayerFrontEnd.xsrfRequest; FormplayerFrontEnd.start(options); var $menuToggle = $('#commcare-menu-toggle'), diff --git a/corehq/apps/cloudcare/static/cloudcare/js/formplayer/menus/api.js b/corehq/apps/cloudcare/static/cloudcare/js/formplayer/menus/api.js index 694fe56a6ea1..f97b116c5a87 100644 --- a/corehq/apps/cloudcare/static/cloudcare/js/formplayer/menus/api.js +++ b/corehq/apps/cloudcare/static/cloudcare/js/formplayer/menus/api.js @@ -263,9 +263,7 @@ hqDefine("cloudcare/js/formplayer/menus/api", [ } // If an endpoint is provided, first claim any cases it references, then navigate - return FormplayerFrontend.xsrfRequest.then(function () { - return API.queryFormplayer(options, "get_endpoint"); - }); + return API.queryFormplayer(options, "get_endpoint"); }); FormplayerFrontend.getChannel().reply("icon:click", function (options) {