How to use the @shopify/app-bridge/actions.Redirect.create 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 / polaris-react / src / utilities / app-bridge-transformers.ts View on Github external
export function generateRedirect(
  appBridge: ClientApplication<{}>,
  url?: string,
  target: AppBridgeTarget = 'APP',
  external?: boolean,
) {
  if (url == null) {
    return undefined;
  }

  const redirect = Redirect.create(appBridge);
  const payload =
    external === true
      ? {
          url,
          newContext: true,
        }
      : url;

  return () => {
    redirect.dispatch(redirectAction(target, external), payload);
  };
}
github Shopify / shopify-demo-app-node-react / components / ResourceList.js View on Github external
redirectToProduct = () => {
    const redirect = Redirect.create(this.context.polaris.appBridge);
    redirect.dispatch(
      Redirect.Action.APP,
      '/edit-products'
    );
  };