diff --git a/kontor-angular/src/app/app.routes.ts b/kontor-angular/src/app/app.routes.ts index 07d6491..631b87d 100644 --- a/kontor-angular/src/app/app.routes.ts +++ b/kontor-angular/src/app/app.routes.ts @@ -1,6 +1,6 @@ import { Routes } from '@angular/router'; import { KontorComponent } from './kontor/kontor.component'; -import { Login } from './common/login/login'; +import { Auth } from './common/auth/auth'; import { ComicSectionComponent } from './kontor/comic/comic-section/comic-section.component'; import { comicRoutes } from './kontor/comic/comic-section/comic-section.routes'; import { TyscSectionComponent } from './kontor/tysc/tysc-section/tysc-section.component'; @@ -10,7 +10,7 @@ import { mediaRoutes } from './kontor/media/media-section/media-section.routes'; export const routes: Routes = [ { path: '', component: KontorComponent, }, - { path: 'login', component: Login, }, + { path: 'login', component: Auth, }, { path: 'comic', component: ComicSectionComponent, children: comicRoutes, diff --git a/kontor-angular/src/app/common/auth/auth-service.spec.ts b/kontor-angular/src/app/common/auth/auth-service.spec.ts new file mode 100644 index 0000000..ef933a9 --- /dev/null +++ b/kontor-angular/src/app/common/auth/auth-service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { AuthService } from './auth-service'; + +describe('AuthService', () => { + let service: AuthService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(AuthService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/kontor-angular/src/app/common/auth/auth-service.ts b/kontor-angular/src/app/common/auth/auth-service.ts new file mode 100644 index 0000000..ce89fe5 --- /dev/null +++ b/kontor-angular/src/app/common/auth/auth-service.ts @@ -0,0 +1,30 @@ +import { HttpClient } from '@angular/common/http'; +import { Injectable } from '@angular/core'; + + +interface AuthResponseData { + kind: string; + idToken: string; + email: string; + refreshToken: string; + expiresIn: string; +} + +@Injectable({ + providedIn: 'root' +}) +export class AuthService { + constructor(private http: HttpClient) { + + } + + signup(email: string, password: string) { + return this.http.post('http://localhost:8800/signup', + { + email: email, + password: password, + returnToken: true + } + ); + } +} diff --git a/kontor-angular/src/app/common/auth/auth.css b/kontor-angular/src/app/common/auth/auth.css new file mode 100644 index 0000000..3b9c625 --- /dev/null +++ b/kontor-angular/src/app/common/auth/auth.css @@ -0,0 +1,8 @@ + +button { + text-align: center; + padding: 10px; + border-radius: 10px; + margin-left: 14px; + +} diff --git a/kontor-angular/src/app/common/auth/auth.html b/kontor-angular/src/app/common/auth/auth.html new file mode 100644 index 0000000..6a6e91e --- /dev/null +++ b/kontor-angular/src/app/common/auth/auth.html @@ -0,0 +1,22 @@ +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
diff --git a/kontor-angular/src/app/common/login/login.spec.ts b/kontor-angular/src/app/common/auth/auth.spec.ts similarity index 63% rename from kontor-angular/src/app/common/login/login.spec.ts rename to kontor-angular/src/app/common/auth/auth.spec.ts index dd8bbb3..fb883cb 100644 --- a/kontor-angular/src/app/common/login/login.spec.ts +++ b/kontor-angular/src/app/common/auth/auth.spec.ts @@ -1,18 +1,18 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { Login } from './login'; +import { Auth } from './auth'; -describe('Login', () => { - let component: Login; - let fixture: ComponentFixture; +describe('Auth', () => { + let component: Auth; + let fixture: ComponentFixture; beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [Login] + imports: [Auth] }) .compileComponents(); - fixture = TestBed.createComponent(Login); + fixture = TestBed.createComponent(Auth); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/kontor-angular/src/app/common/auth/auth.ts b/kontor-angular/src/app/common/auth/auth.ts new file mode 100644 index 0000000..af237a0 --- /dev/null +++ b/kontor-angular/src/app/common/auth/auth.ts @@ -0,0 +1,21 @@ +import { Component } from '@angular/core'; +import { FormsModule } from '@angular/forms'; +import { NgForm } from '@angular/forms'; + +@Component({ + selector: 'app-auth', + imports: [FormsModule], + templateUrl: './auth.html', + styleUrl: './auth.css' +}) +export class Auth { + isLoginMode = true; + + onSwitchMode() { + this.isLoginMode =!this.isLoginMode; + } + onSubmit(form: NgForm) { + console.log(form.value); + form.reset(); + } +} diff --git a/kontor-angular/src/app/common/login/login.css b/kontor-angular/src/app/common/login/login.css deleted file mode 100644 index e69de29..0000000 diff --git a/kontor-angular/src/app/common/login/login.html b/kontor-angular/src/app/common/login/login.html deleted file mode 100644 index 147cfc4..0000000 --- a/kontor-angular/src/app/common/login/login.html +++ /dev/null @@ -1 +0,0 @@ -

login works!

diff --git a/kontor-angular/src/app/common/login/login.ts b/kontor-angular/src/app/common/login/login.ts deleted file mode 100644 index c39dbb9..0000000 --- a/kontor-angular/src/app/common/login/login.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-login', - imports: [], - templateUrl: './login.html', - styleUrl: './login.css' -}) -export class Login { - -} diff --git a/kontor-angular/src/app/kontor/navigation/navigation.component.html b/kontor-angular/src/app/kontor/navigation/navigation.component.html index f7c8699..b691db0 100644 --- a/kontor-angular/src/app/kontor/navigation/navigation.component.html +++ b/kontor-angular/src/app/kontor/navigation/navigation.component.html @@ -1,6 +1,7 @@ diff --git a/kontor-angular/src/styles.css b/kontor-angular/src/styles.css index d8c6b3a..57d9c06 100644 --- a/kontor-angular/src/styles.css +++ b/kontor-angular/src/styles.css @@ -31,6 +31,12 @@ body { color: black; } +.topnav :last-child { + float: right; + margin-left: auto; + margin-right: 16px; +} + .subnav { overflow: hidden; background-color: grey;