diff --git a/frontend/src/app/api.service.ts b/frontend/src/app/api.service.ts
index 44aeb83..b1c9994 100644
--- a/frontend/src/app/api.service.ts
+++ b/frontend/src/app/api.service.ts
@@ -1,7 +1,7 @@
import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {environment} from '../environments/environment';
-import {LoginService} from './shared/login.service';
+import {LoginService} from './auth/login.service';
@Injectable({
providedIn: 'root'
diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts
index bd58cc0..266db6e 100644
--- a/frontend/src/app/app-routing.module.ts
+++ b/frontend/src/app/app-routing.module.ts
@@ -1,11 +1,21 @@
-import {NgModule} from '@angular/core';
-import {RouterModule, Routes} from '@angular/router';
-import {LoginComponent} from './login/login.component';
-import {RegisterComponent} from './register/register.component';
+import { NgModule } from '@angular/core';
+import { RouterModule, Routes } from '@angular/router';
+import { AuthCheck } from './auth-check';
const routes: Routes = [
- {path: 'login', component: LoginComponent},
- {path: 'register', component: RegisterComponent}
+ {
+ path: '',
+ children: [
+ {path: 'auth', loadChildren: async () => (await import('./auth/auth.module')).AuthModule}
+ ]
+ },
+ {
+ path: '',
+ canActivate: [AuthCheck],
+ children: [
+ {path: 'users', loadChildren: async () => (await import('./users/users.module')).UsersModule}
+ ]
+ }
];
@NgModule({
diff --git a/frontend/src/app/app.component.html b/frontend/src/app/app.component.html
index 5569e18..77e14f3 100644
--- a/frontend/src/app/app.component.html
+++ b/frontend/src/app/app.component.html
@@ -26,8 +26,8 @@
Kijelentkezés
- Regisztráció
-
+ Regisztráció
+
Bejelentkezés
login
diff --git a/frontend/src/app/app.component.ts b/frontend/src/app/app.component.ts
index b2f47fe..ad717f4 100644
--- a/frontend/src/app/app.component.ts
+++ b/frontend/src/app/app.component.ts
@@ -2,7 +2,7 @@ import {Component, OnInit} from '@angular/core';
import {BreakpointObserver, Breakpoints} from '@angular/cdk/layout';
import {Observable} from 'rxjs';
import {map, shareReplay} from 'rxjs/operators';
-import {LoginService} from './shared/login.service';
+import {LoginService} from './auth/login.service';
import {Router} from '@angular/router';
import {ApiService} from './api.service';
import {UserRole} from './model/user.model';
diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts
index c9c9aa5..db131ab 100644
--- a/frontend/src/app/app.module.ts
+++ b/frontend/src/app/app.module.ts
@@ -1,29 +1,26 @@
-import {BrowserModule} from '@angular/platform-browser';
-import {NgModule} from '@angular/core';
+import { BrowserModule } from '@angular/platform-browser';
+import { NgModule } from '@angular/core';
-import {AppComponent} from './app.component';
-import {LoginComponent} from './login/login.component';
-import {AppRoutingModule} from './app-routing.module';
-import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
-import {MatSliderModule} from '@angular/material/slider';
-import {LayoutModule} from '@angular/cdk/layout';
-import {MatToolbarModule} from '@angular/material/toolbar';
-import {MatButtonModule} from '@angular/material/button';
-import {MatSidenavModule} from '@angular/material/sidenav';
-import {MatIconModule} from '@angular/material/icon';
-import {MatListModule} from '@angular/material/list';
-import {FormsModule, ReactiveFormsModule} from '@angular/forms';
-import {MatFormFieldModule} from '@angular/material/form-field';
-import {MatInputModule} from '@angular/material/input';
-import {RegisterComponent} from './register/register.component';
-import {LoginService} from './shared/login.service';
-import {HttpClientModule} from '@angular/common/http';
+import { AppComponent } from './app.component';
+import { AppRoutingModule } from './app-routing.module';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { MatSliderModule } from '@angular/material/slider';
+import { LayoutModule } from '@angular/cdk/layout';
+import { MatToolbarModule } from '@angular/material/toolbar';
+import { MatButtonModule } from '@angular/material/button';
+import { MatSidenavModule } from '@angular/material/sidenav';
+import { MatIconModule } from '@angular/material/icon';
+import { MatListModule } from '@angular/material/list';
+import { FormsModule, ReactiveFormsModule } from '@angular/forms';
+import { MatFormFieldModule } from '@angular/material/form-field';
+import { MatInputModule } from '@angular/material/input';
+import { LoginService } from './auth/login.service';
+import { HttpClientModule } from '@angular/common/http';
+import { AuthCheck } from './auth-check';
@NgModule({
declarations: [
- AppComponent,
- LoginComponent,
- RegisterComponent
+ AppComponent
],
imports: [
BrowserModule,
@@ -43,7 +40,8 @@ import {HttpClientModule} from '@angular/common/http';
HttpClientModule
],
providers: [
- LoginService
+ LoginService,
+ AuthCheck
],
bootstrap: [AppComponent]
})
diff --git a/frontend/src/app/auth-check.ts b/frontend/src/app/auth-check.ts
new file mode 100644
index 0000000..3ee4722
--- /dev/null
+++ b/frontend/src/app/auth-check.ts
@@ -0,0 +1,13 @@
+import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router';
+import { Injectable } from '@angular/core';
+import { LoginService } from './auth/login.service';
+
+@Injectable()
+export class AuthCheck implements CanActivate {
+ constructor(private userService: LoginService) {
+ }
+
+ canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
+ return this.userService.token && this.userService.user && true;
+ }
+}
diff --git a/frontend/src/app/auth/auth.module.ts b/frontend/src/app/auth/auth.module.ts
new file mode 100644
index 0000000..d221391
--- /dev/null
+++ b/frontend/src/app/auth/auth.module.ts
@@ -0,0 +1,32 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { LoginComponent } from './login/login.component';
+import { RegisterComponent } from './register/register.component';
+import { FormsModule, ReactiveFormsModule } from '@angular/forms';
+import { MatInputModule } from '@angular/material/input';
+import { MatButtonModule } from '@angular/material/button';
+import { MatFormFieldModule } from '@angular/material/form-field';
+import { RouterModule, Routes } from '@angular/router';
+
+const routes: Routes = [
+ {path: 'login', component: LoginComponent},
+ {path: 'register', component: RegisterComponent}
+];
+
+@NgModule({
+ declarations: [
+ LoginComponent,
+ RegisterComponent
+ ],
+ imports: [
+ CommonModule,
+ ReactiveFormsModule,
+ MatInputModule,
+ MatButtonModule,
+ MatFormFieldModule,
+ FormsModule,
+ RouterModule.forChild(routes)
+ ]
+})
+export class AuthModule {
+}
diff --git a/frontend/src/app/shared/login.service.spec.ts b/frontend/src/app/auth/login.service.spec.ts
similarity index 100%
rename from frontend/src/app/shared/login.service.spec.ts
rename to frontend/src/app/auth/login.service.spec.ts
diff --git a/frontend/src/app/shared/login.service.ts b/frontend/src/app/auth/login.service.ts
similarity index 100%
rename from frontend/src/app/shared/login.service.ts
rename to frontend/src/app/auth/login.service.ts
diff --git a/frontend/src/app/login/login.component.css b/frontend/src/app/auth/login/login.component.css
similarity index 100%
rename from frontend/src/app/login/login.component.css
rename to frontend/src/app/auth/login/login.component.css
diff --git a/frontend/src/app/login/login.component.html b/frontend/src/app/auth/login/login.component.html
similarity index 100%
rename from frontend/src/app/login/login.component.html
rename to frontend/src/app/auth/login/login.component.html
diff --git a/frontend/src/app/login/login.component.spec.ts b/frontend/src/app/auth/login/login.component.spec.ts
similarity index 100%
rename from frontend/src/app/login/login.component.spec.ts
rename to frontend/src/app/auth/login/login.component.spec.ts
diff --git a/frontend/src/app/login/login.component.ts b/frontend/src/app/auth/login/login.component.ts
similarity index 86%
rename from frontend/src/app/login/login.component.ts
rename to frontend/src/app/auth/login/login.component.ts
index 5a5b15f..109af73 100644
--- a/frontend/src/app/login/login.component.ts
+++ b/frontend/src/app/auth/login/login.component.ts
@@ -1,7 +1,7 @@
import {Component, OnInit} from '@angular/core';
import {Router} from '@angular/router';
-import {LoginService} from '../shared/login.service';
-import {FormErrorStateMatcher} from '../utility/form-error-state-matcher';
+import {LoginService} from '../login.service';
+import {FormErrorStateMatcher} from '../../utility/form-error-state-matcher';
import {FormControl} from '@angular/forms';
@Component({
diff --git a/frontend/src/app/register/register.component.css b/frontend/src/app/auth/register/register.component.css
similarity index 100%
rename from frontend/src/app/register/register.component.css
rename to frontend/src/app/auth/register/register.component.css
diff --git a/frontend/src/app/register/register.component.html b/frontend/src/app/auth/register/register.component.html
similarity index 100%
rename from frontend/src/app/register/register.component.html
rename to frontend/src/app/auth/register/register.component.html
diff --git a/frontend/src/app/register/register.component.spec.ts b/frontend/src/app/auth/register/register.component.spec.ts
similarity index 100%
rename from frontend/src/app/register/register.component.spec.ts
rename to frontend/src/app/auth/register/register.component.spec.ts
diff --git a/frontend/src/app/register/register.component.ts b/frontend/src/app/auth/register/register.component.ts
similarity index 93%
rename from frontend/src/app/register/register.component.ts
rename to frontend/src/app/auth/register/register.component.ts
index e9dbb9b..49dfcea 100644
--- a/frontend/src/app/register/register.component.ts
+++ b/frontend/src/app/auth/register/register.component.ts
@@ -1,8 +1,8 @@
import {Component, OnInit} from '@angular/core';
import {AbstractControl, FormControl, ValidationErrors, Validators} from '@angular/forms';
-import {LoginService} from '../shared/login.service';
+import {LoginService} from '../login.service';
import {Router} from '@angular/router';
-import {FormErrorStateMatcher} from '../utility/form-error-state-matcher';
+import {FormErrorStateMatcher} from '../../utility/form-error-state-matcher';
@Component({
selector: 'app-register',
diff --git a/frontend/src/app/users/user-list/user-list.component.css b/frontend/src/app/users/user-list/user-list.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/frontend/src/app/users/user-list/user-list.component.html b/frontend/src/app/users/user-list/user-list.component.html
new file mode 100644
index 0000000..16029d7
--- /dev/null
+++ b/frontend/src/app/users/user-list/user-list.component.html
@@ -0,0 +1 @@
+user-list works!
diff --git a/frontend/src/app/users/user-list/user-list.component.spec.ts b/frontend/src/app/users/user-list/user-list.component.spec.ts
new file mode 100644
index 0000000..807863b
--- /dev/null
+++ b/frontend/src/app/users/user-list/user-list.component.spec.ts
@@ -0,0 +1,25 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { UserListComponent } from './user-list.component';
+
+describe('UserListComponent', () => {
+ let component: UserListComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ UserListComponent ]
+ })
+ .compileComponents();
+ });
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(UserListComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/frontend/src/app/users/user-list/user-list.component.ts b/frontend/src/app/users/user-list/user-list.component.ts
new file mode 100644
index 0000000..0098a48
--- /dev/null
+++ b/frontend/src/app/users/user-list/user-list.component.ts
@@ -0,0 +1,15 @@
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-user-list',
+ templateUrl: './user-list.component.html',
+ styleUrls: ['./user-list.component.css']
+})
+export class UserListComponent implements OnInit {
+
+ constructor() { }
+
+ ngOnInit(): void {
+ }
+
+}
diff --git a/frontend/src/app/users/users.module.ts b/frontend/src/app/users/users.module.ts
new file mode 100644
index 0000000..113a6de
--- /dev/null
+++ b/frontend/src/app/users/users.module.ts
@@ -0,0 +1,13 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { UserListComponent } from './user-list/user-list.component';
+
+
+
+@NgModule({
+ declarations: [UserListComponent],
+ imports: [
+ CommonModule
+ ]
+})
+export class UsersModule { }