# elementor/3.8.0-beta1/app/assets/js/hooks/use-action.js

Elementor Website Builder – more than just a page builder, version 3.8.0-beta1. 22 lines.

- Page: https://pluginprobe.com/plugins/elementor/3.8.0-beta1/code/app/assets/js/hooks/use-action.js
- Raw: https://pluginprobe.com/plugins/elementor/3.8.0-beta1/raw/app/assets/js/hooks/use-action.js
- Modified: 2022-09-19T16:26:20+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/elementor/3.8.0-beta1/code/app/assets/js/hooks/use-action.js#L10-L20`.

```javascript
export default function useAction() {
	return {
		backToDashboard: () => {
			if ( window.top === window ) {
				window.top.location = elementorAppConfig.admin_url;
			} else {
				// Iframe.
				window.top.$e.run( 'app/close' );
			}
		},
		backToReferrer: () => {
			if ( window.top === window ) {
				// Directly - in case that the return_url is the login-page, the target should be the admin-page and not the login-page again.
				window.top.location = elementorAppConfig.return_url.includes( elementorAppConfig.login_url ) ? elementorAppConfig.admin_url : elementorAppConfig.return_url;
			} else {
				// Iframe.
				window.top.$e.run( 'app/close' );
			}
		},
	};
}

```
