This commit is contained in:
Jesper Møller Jensen
2023-05-26 13:58:20 +12:00
parent 47bed001ac
commit 268cb6ac23
2 changed files with 6 additions and 6 deletions

View File

@@ -1,9 +1,9 @@
import { LoginRequestModel, IUmbAuthContext } from './types';
import { LoginRequestModel, IUmbAuthContext, LoginResponse } from './types';
export class UmbAuthLegacyContext implements IUmbAuthContext {
readonly #AUTH_URL = '/umbraco/backoffice/umbracoapi/authentication/postlogin';
login(data: LoginRequestModel): Promise<{ error?: string | undefined }> {
login(data: LoginRequestModel): Promise<LoginResponse> {
throw new Error('Method not implemented.');
}
}

View File

@@ -67,12 +67,12 @@ export default class UmbLoginElement extends LitElement {
this._loginState = 'waiting';
const { error } = await this.#authContext.login({ username, password, persist });
const response = await this.#authContext.login({ username, password, persist });
this._loginError = error || '';
this._loginState = error ? 'failed' : 'success';
this._loginError = response.error || '';
this._loginState = response.error ? 'failed' : 'success';
if (error) return;
if (response.error) return;
location.href = this.returnUrl;
};