Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
};
}
redirectToProduct = () => {
const redirect = Redirect.create(this.context.polaris.appBridge);
redirect.dispatch(
Redirect.Action.APP,
'/edit-products'
);
};