How to use the @shopify/app-bridge/actions.AuthCode.request function in @shopify/app-bridge

To help you get started, we’ve selected a few @shopify/app-bridge examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Shopify / next-gen-auth-app-demo / app / javascript / utilities / protectedFetch.js View on Github external
return new Promise((resolve, reject) => {
    const unsubscribe = appBridge.subscribe(AuthCode.ActionType.RESPOND, (payload) => {
      if (payload) {
        resolve(payload);
      } else {
        reject("Failed to load");
      }
      unsubscribe();
    });

    appBridge.dispatch(AuthCode.request());
  });
}