Initial commit for the Angular part. We are nowhere yet.

This commit is contained in:
Amritanshu
2019-06-14 00:32:34 +05:30
parent 1a1fa7881d
commit d59c60e81d
123 changed files with 3748 additions and 374 deletions

View File

View File

@ -0,0 +1,16 @@
<a mat-raised-button routerLink="/login" *ngIf="!(nameObject | async)">
<mat-icon>account_box</mat-icon>
Login</a>
<a mat-raised-button routerLink="/guest-book/list">
Guest Book
</a>
<a mat-raised-button routerLink="/running-tables">
Sales
</a>
<a mat-raised-button routerLink="/tables">
Tables
</a>
<a mat-raised-button routerLink="/logout" *ngIf="nameObject | async as name">
<mat-icon>account_box</mat-icon>
Logout {{name}}
</a>

View File

@ -0,0 +1,25 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {HomeComponent} from './home.component';
describe('HomeComponent', () => {
let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [HomeComponent]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,25 @@
import {Component, OnInit} from '@angular/core';
import {Subject} from "rxjs";
import {AuthService} from "../auth/auth.service";
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
public nameObject = new Subject<string>();
constructor(private auth: AuthService) {
}
ngOnInit() {
this.auth.userObservable.subscribe((user) => {
if (user.isAuthenticated) {
this.nameObject.next(user.name);
} else {
this.nameObject.next(null);
}
});
}
}