Proxy KO
This commit is contained in:
parent
bc512fe0a5
commit
b815335ba3
|
@ -72,7 +72,8 @@
|
|||
"buildTarget": "recetes-web:build:production"
|
||||
},
|
||||
"development": {
|
||||
"buildTarget": "recetes-web:build:development"
|
||||
"buildTarget": "recetes-web:build:development",
|
||||
"proxyConfig": "proxy.conf.json"
|
||||
}
|
||||
},
|
||||
"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 { BASE_PATH } from 'recettes-ng-client';
|
||||
import { environment } from '../environments/environment';
|
||||
import { ApiModule, Configuration } from 'recettes-ng-client';
|
||||
import { AuthService } from './auth.service';
|
||||
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
|
@ -12,6 +14,17 @@ export const appConfig: ApplicationConfig = {
|
|||
{
|
||||
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),
|
||||
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 { CommonModule, NgFor } from '@angular/common';
|
||||
import { Receipe, ReceipeService } from 'recettes-ng-client';
|
||||
import { AppModule } from '../app.module';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
@Component({
|
||||
selector: 'app-receipes-list',
|
||||
standalone: true,
|
||||
imports: [CommonModule, AppModule, NgFor],
|
||||
imports: [CommonModule, NgFor],
|
||||
templateUrl: './receipes-list.component.html',
|
||||
styleUrl: './receipes-list.component.scss'
|
||||
})
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
export const environment = {
|
||||
apiUrl: 'http://localhost:8080'
|
||||
apiUrl: 'http://localhost:4200/api'
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue