mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2025-06-28 18:05:12 +00:00
Refactor WebComponent and iframing to be mutually exclusive, strip old app
This commit is contained in:
@ -1,39 +1,2 @@
|
||||
<!--
|
||||
<div>
|
||||
<h1>Login page</h1>
|
||||
<form #loginForm="ngForm" (submit)="onSubmit()" [hidden]="submitted">
|
||||
<div class="form-group">
|
||||
<label for="email_input">Email:</label>
|
||||
<input
|
||||
id="email_input"
|
||||
class="form-control"
|
||||
type="email"
|
||||
name="email"
|
||||
placeholder="Enter email"
|
||||
[(ngModel)]="model.email"
|
||||
>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password_input">Password:</label>
|
||||
<input
|
||||
id="password_input"
|
||||
class="form-control"
|
||||
type="password"
|
||||
name="password"
|
||||
placeholder="Password"
|
||||
[(ngModel)]="model.password"
|
||||
>
|
||||
</div>
|
||||
<button type="submit" class="btn tao-btn-primary">Submit</button>
|
||||
</form>
|
||||
<div [hidden]="!submitted">
|
||||
<p>
|
||||
Logged in as {{logged_in_email}}.
|
||||
You <em><span *ngIf="!is_admin">don't </span>have</em> admin privileges.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
<div class="iframe-container">
|
||||
|
||||
</div>
|
||||
<h2>WebComponent is here!</h2>
|
||||
<p>Edit me if you want to write your own component in Angular!</p>
|
||||
|
@ -1,36 +1,12 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Login } from './web';
|
||||
import { DeploymentNotificationService } from '../services/deployment-notification.service';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
// Edit me if you want to write your own component in Angular!
|
||||
import { Component } from '@angular/core';
|
||||
import { config } from '../config'
|
||||
|
||||
@Component({
|
||||
selector: 'app-web',
|
||||
templateUrl: './web.component.html',
|
||||
styleUrls: ['./web.component.scss']
|
||||
})
|
||||
export class LoginComponent {
|
||||
model = new Login('', '');
|
||||
submitted = false;
|
||||
is_admin: boolean;
|
||||
logged_in_email: string;
|
||||
|
||||
constructor(
|
||||
private http: HttpClient
|
||||
) {}
|
||||
|
||||
onSubmit() {
|
||||
this.postLogin(this.model).subscribe(
|
||||
res => {
|
||||
this.logged_in_email = res['email'];
|
||||
this.is_admin = res['is_admin'];
|
||||
}
|
||||
);
|
||||
this.submitted = true;
|
||||
}
|
||||
|
||||
postLogin(login: Login): Observable<any> {
|
||||
return this.http.post<Login>('/web', login);
|
||||
}
|
||||
export class WebComponent {
|
||||
constructor() {}
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
export class Login {
|
||||
|
||||
constructor(
|
||||
public email: string,
|
||||
public password: string
|
||||
) {}
|
||||
|
||||
}
|
Reference in New Issue
Block a user