import { Component, h} from '@stencil/core';
import { Api } from '../api';

@Component({
  tag: 'app-home',
  styleUrl: 'app-home.css',
  shadow: true,
})
export class AppHome {
  constructor() {
    this.start();
    
  }

  async start() {
    await Api.login('test', 'test');
    let data = await Api.get("/users/me");
    console.log(data);
    data = await Api.post("/server/dummy/start");
    console.log(data);
    data = await Api.post("/server/dummy/stop");
    console.log(data);
  }

  render() {
    return (
      <div class="app-home">
        <p>
          Welcome to the Stencil App Starter. You can use this starter to build entire apps all with web components using Stencil! Check out our docs on{' '}
          <a href="https://stenciljs.com">stenciljs.com</a> to get started.
        </p>

        <stencil-route-link url="/profile/stencil">
          <button>Profile page</button>
        </stencil-route-link>
      </div>
    );
  }
}
