replace old fetch calls with new fetchers
This commit is contained in:
@@ -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 } }));
|
||||
|
||||
@@ -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 }));
|
||||
|
||||
@@ -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<UmbRoute> = [
|
||||
{
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user