diff --git a/package.json b/package.json index 9d7b66d..40bfc7f 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "scripts": { "ng": "ng", - "start": "ng serve", + "start": "ng serve --proxy-config proxy.config.local.json ", "build": "ng build", "watch": "ng build --watch --configuration development", "test": "ng test" diff --git a/proxy.config.local.json b/proxy.config.local.json new file mode 100644 index 0000000..d506cf3 --- /dev/null +++ b/proxy.config.local.json @@ -0,0 +1,8 @@ +{ + "/api": { + "target": "http://localhost:3334", + "secure": false, + "changeOrigin": false, + "logLevel": "debug" + } +} \ No newline at end of file diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index a55af5a..008360c 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,9 +1,9 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; -import { DashboardComponent } from './dashboard/dashboard.component'; +import { DashboardComponent } from './components/dashboard/dashboard.component'; +import { SplashComponent } from './components/splash/splash.component'; import { AppLayoutComponent } from './layout/app.layout.component'; -import { SplashComponent } from './splash/splash.component'; const routes: Routes = [ { @@ -15,7 +15,7 @@ const routes: Routes = [ component: AppLayoutComponent, children: [ { - path: 'dashboard', + path: ':address', component: DashboardComponent } ] diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 04e6840..ee2a7b7 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,13 +1,14 @@ import { CommonModule, HashLocationStrategy, LocationStrategy } from '@angular/common'; import { NgModule } from '@angular/core'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser'; import { PrimeNGModule } from '../prime-ng.module'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; -import { DashboardComponent } from './dashboard/dashboard.component'; +import { DashboardComponent } from './components/dashboard/dashboard.component'; +import { SplashComponent } from './components/splash/splash.component'; import { AppLayoutModule } from './layout/app.layout.module'; -import { SplashComponent } from './splash/splash.component'; @NgModule({ declarations: [ @@ -20,7 +21,9 @@ import { SplashComponent } from './splash/splash.component'; BrowserModule, AppRoutingModule, PrimeNGModule, - AppLayoutModule + AppLayoutModule, + FormsModule, + ReactiveFormsModule ], providers: [ { provide: LocationStrategy, useClass: HashLocationStrategy }, diff --git a/src/app/components/dashboard/dashboard.component.html b/src/app/components/dashboard/dashboard.component.html new file mode 100644 index 0000000..64d1f38 --- /dev/null +++ b/src/app/components/dashboard/dashboard.component.html @@ -0,0 +1,5 @@ +
+ {{clientInfo$ | async | json}}
+
+dashboard works!
diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts deleted file mode 100644 index 69c4b8f..0000000 --- a/src/app/dashboard/dashboard.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-dashboard', - templateUrl: './dashboard.component.html', - styleUrls: ['./dashboard.component.scss'] -}) -export class DashboardComponent { - -} diff --git a/src/app/services/client.service.spec.ts b/src/app/services/client.service.spec.ts new file mode 100644 index 0000000..776372f --- /dev/null +++ b/src/app/services/client.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { ClientService } from './client.service'; + +describe('ClientService', () => { + let service: ClientService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(ClientService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/client.service.ts b/src/app/services/client.service.ts new file mode 100644 index 0000000..68f1426 --- /dev/null +++ b/src/app/services/client.service.ts @@ -0,0 +1,18 @@ +import { HttpClient } from '@angular/common/http'; +import { Injectable } from '@angular/core'; + +import { environment } from '../../environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class ClientService { + + constructor( + private httpClient: HttpClient + ) { } + + public getClientInfo(address: string) { + return this.httpClient.get(`${environment.API_URL}/api/client/${address}`); + } +} diff --git a/src/app/splash/splash.component.scss b/src/app/splash/splash.component.scss deleted file mode 100644 index e69de29..0000000