diff --git a/src/Umbraco.Web.UI.Client/src/auth/login/umb-login.element.ts b/src/Umbraco.Web.UI.Client/src/auth/login/umb-login.element.ts index 7e74420f96..a4e19e0bc7 100644 --- a/src/Umbraco.Web.UI.Client/src/auth/login/umb-login.element.ts +++ b/src/Umbraco.Web.UI.Client/src/auth/login/umb-login.element.ts @@ -1,8 +1,10 @@ -import { html, css, LitElement, CSSResultGroup } from 'lit'; -import { customElement, state } from 'lit/decorators.js'; 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 { postUserLogin } from '../../api/fetcher'; + // create custom element with lit-element named 'umb-login' @customElement('umb-login') @@ -43,7 +45,7 @@ export class UmbLogin extends LitElement { this._loggingIn = true; try { - await fetch('/login', { method: 'POST' }); + await postUserLogin({ username, password, persist }); this._loggingIn = false; // TODO: Change to redirect when router has been added. this.dispatchEvent(new CustomEvent('login', { bubbles: true, composed: true, detail: { username, password, persist } })); diff --git a/src/Umbraco.Web.UI.Client/src/installer/installer-user.element.ts b/src/Umbraco.Web.UI.Client/src/installer/installer-user.element.ts index e422c2cb59..46ea2bc9c7 100644 --- a/src/Umbraco.Web.UI.Client/src/installer/installer-user.element.ts +++ b/src/Umbraco.Web.UI.Client/src/installer/installer-user.element.ts @@ -1,6 +1,8 @@ import { css, CSSResultGroup, html, LitElement } from 'lit'; import { customElement } from 'lit/decorators.js'; +import { postInstall } from '../api/fetcher'; + @customElement('umb-installer-user') export class UmbInstallerUser extends LitElement { static styles: CSSResultGroup = [ @@ -35,7 +37,7 @@ export class UmbInstallerUser extends LitElement { console.log('Installing', name, email, password, news); try { - await fetch('/install', { method: 'POST' }); + await postInstall({}); // TODO: Change to redirect when router has been added. this.dispatchEvent(new CustomEvent('install', { bubbles: true, composed: true })); diff --git a/src/Umbraco.Web.UI.Client/src/umb-app.ts b/src/Umbraco.Web.UI.Client/src/umb-app.ts index e173027547..64c4693966 100644 --- a/src/Umbraco.Web.UI.Client/src/umb-app.ts +++ b/src/Umbraco.Web.UI.Client/src/umb-app.ts @@ -1,16 +1,16 @@ -import './installer/installer.element'; import './auth/login/umb-login.element'; import './auth/umb-auth-layout.element'; import './backoffice/umb-backoffice.element'; - +import './installer/installer.element'; import '@umbraco-ui/uui'; import '@umbraco-ui/uui-css/dist/uui-css.css'; import { css, html, LitElement } from 'lit'; import { customElement, state } from 'lit/decorators.js'; +import { getInitStatus } from './api/fetcher'; +import { UmbRoute, UmbRouter } from './core/router'; import { worker } from './mocks/browser'; -import { UmbRouter, UmbRoute } from './core/router'; const routes: Array = [ { @@ -66,8 +66,7 @@ export class UmbApp extends LitElement { this._router.setRoutes(routes); try { - const res = await fetch('/init', { method: 'POST' }); - const data = await res.json(); + const { data } = await getInitStatus({}); if (!data.installed) { this._router.push('/install');