diff --git a/src/Umbraco.Web.UI.Client/src/auth/login/login.element.ts b/src/Umbraco.Web.UI.Client/src/auth/login/login.element.ts index 7d9cda0384..216fb81965 100644 --- a/src/Umbraco.Web.UI.Client/src/auth/login/login.element.ts +++ b/src/Umbraco.Web.UI.Client/src/auth/login/login.element.ts @@ -1,12 +1,13 @@ +import '../auth-layout.element'; + import { UUITextStyles } from '@umbraco-ui/uui-css'; import { css, CSSResultGroup, html, LitElement } from 'lit'; import { customElement, state } from 'lit/decorators.js'; import { ifDefined } from 'lit/directives/if-defined.js'; +import { query } from 'router-slot'; import { postUserLogin } from '../../core/api/fetcher'; -import '../auth-layout.element'; - @customElement('umb-login') export default class UmbLogin extends LitElement { static styles: CSSResultGroup = [ @@ -46,7 +47,11 @@ export default class UmbLogin extends LitElement { try { await postUserLogin({ username, password, persist }); this._loggingIn = false; - history.pushState(null, '', '/section'); + let { redirectTo } = query(); + if (!redirectTo) { + redirectTo = '/section'; + } + history.pushState(null, '', redirectTo); } catch (error) { console.log(error); this._loggingIn = false;