From 8604fa123ea4092fa5b1cf190a33b1f64a9a0f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20M=C3=B8ller=20Jensen?= <26099018+JesmoDev@users.noreply.github.com> Date: Wed, 24 May 2023 18:11:52 +1200 Subject: [PATCH] add redirecting --- src/Umbraco.Web.UI.Client/apps/auth/index.html | 2 +- src/Umbraco.Web.UI.Client/apps/auth/src/auth-new.context.ts | 2 +- src/Umbraco.Web.UI.Client/apps/auth/src/login.element.ts | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/apps/auth/index.html b/src/Umbraco.Web.UI.Client/apps/auth/index.html index 75922ccae2..de2b8a4cdc 100644 --- a/src/Umbraco.Web.UI.Client/apps/auth/index.html +++ b/src/Umbraco.Web.UI.Client/apps/auth/index.html @@ -10,6 +10,6 @@ - + diff --git a/src/Umbraco.Web.UI.Client/apps/auth/src/auth-new.context.ts b/src/Umbraco.Web.UI.Client/apps/auth/src/auth-new.context.ts index 6699fc84e4..8f4d726ab8 100644 --- a/src/Umbraco.Web.UI.Client/apps/auth/src/auth-new.context.ts +++ b/src/Umbraco.Web.UI.Client/apps/auth/src/auth-new.context.ts @@ -11,7 +11,7 @@ export class UmbAuthNewContext implements UmbAuthContext { async login(data: LoginRequestModel) { //TODO: call authUrl with data - const { error } = await UmbMockAPI.login(data, true); + const { error } = await UmbMockAPI.login(data, false); //TODO Should the redirect be done here? or in the login element? diff --git a/src/Umbraco.Web.UI.Client/apps/auth/src/login.element.ts b/src/Umbraco.Web.UI.Client/apps/auth/src/login.element.ts index 348b7f044c..5349e750b9 100644 --- a/src/Umbraco.Web.UI.Client/apps/auth/src/login.element.ts +++ b/src/Umbraco.Web.UI.Client/apps/auth/src/login.element.ts @@ -69,6 +69,11 @@ export default class UmbLoginElement extends LitElement { this._loginError = error || ''; this._loginState = error ? 'failed' : 'success'; + + if (error) return; + + //TODO: Should redirecting be done here or in the context? + location.replace(this.returnUrl); }; @state()