Proxy KO
This commit is contained in:
parent
bc512fe0a5
commit
b815335ba3
|
@ -72,7 +72,8 @@
|
||||||
"buildTarget": "recetes-web:build:production"
|
"buildTarget": "recetes-web:build:production"
|
||||||
},
|
},
|
||||||
"development": {
|
"development": {
|
||||||
"buildTarget": "recetes-web:build:development"
|
"buildTarget": "recetes-web:build:development",
|
||||||
|
"proxyConfig": "proxy.conf.json"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"defaultConfiguration": "development"
|
"defaultConfiguration": "development"
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"/api": {
|
||||||
|
"target": "http://localhost:8080",
|
||||||
|
"secure": false
|
||||||
|
},
|
||||||
|
"/oauth2": {
|
||||||
|
"target": "http://localhost:8080/oauth2",
|
||||||
|
"secure": false
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,8 @@ import { routes } from './app.routes';
|
||||||
import { provideHttpClient } from '@angular/common/http';
|
import { provideHttpClient } from '@angular/common/http';
|
||||||
import { BASE_PATH } from 'recettes-ng-client';
|
import { BASE_PATH } from 'recettes-ng-client';
|
||||||
import { environment } from '../environments/environment';
|
import { environment } from '../environments/environment';
|
||||||
|
import { ApiModule, Configuration } from 'recettes-ng-client';
|
||||||
|
import { AuthService } from './auth.service';
|
||||||
|
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
|
@ -12,6 +14,17 @@ export const appConfig: ApplicationConfig = {
|
||||||
{
|
{
|
||||||
provide: BASE_PATH, useValue: environment.apiUrl
|
provide: BASE_PATH, useValue: environment.apiUrl
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
provide: Configuration,
|
||||||
|
useFactory: (authService: AuthService) => new Configuration(
|
||||||
|
{
|
||||||
|
basePath: environment.apiUrl,
|
||||||
|
accessToken: authService.getAccessToken.bind(authService)
|
||||||
|
}
|
||||||
|
),
|
||||||
|
deps: [AuthService],
|
||||||
|
multi: false
|
||||||
|
},
|
||||||
provideRouter(routes),
|
provideRouter(routes),
|
||||||
provideHttpClient()
|
provideHttpClient()
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { ApiModule, Configuration } from 'recettes-ng-client';
|
|
||||||
import { AuthService } from './auth.service';
|
|
||||||
import { environment } from '../environments/environment';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [ ApiModule ],
|
|
||||||
providers: [
|
|
||||||
{
|
|
||||||
provide: Configuration,
|
|
||||||
useFactory: (authService: AuthService) => new Configuration(
|
|
||||||
{
|
|
||||||
basePath: environment.apiUrl,
|
|
||||||
accessToken: authService.getAccessToken.bind(authService)
|
|
||||||
}
|
|
||||||
),
|
|
||||||
deps: [AuthService],
|
|
||||||
multi: false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export class AppModule {}
|
|
|
@ -1,13 +1,12 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { CommonModule, NgFor } from '@angular/common';
|
import { CommonModule, NgFor } from '@angular/common';
|
||||||
import { Receipe, ReceipeService } from 'recettes-ng-client';
|
import { Receipe, ReceipeService } from 'recettes-ng-client';
|
||||||
import { AppModule } from '../app.module';
|
|
||||||
import { environment } from '../../environments/environment';
|
import { environment } from '../../environments/environment';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-receipes-list',
|
selector: 'app-receipes-list',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, AppModule, NgFor],
|
imports: [CommonModule, NgFor],
|
||||||
templateUrl: './receipes-list.component.html',
|
templateUrl: './receipes-list.component.html',
|
||||||
styleUrl: './receipes-list.component.scss'
|
styleUrl: './receipes-list.component.scss'
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
export const environment = {
|
export const environment = {
|
||||||
apiUrl: 'http://localhost:8080'
|
apiUrl: 'http://localhost:4200/api'
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue