@@ -85,6 +85,8 @@ import { ProfileService } from '../core/services/profile.service';
8585import { SedaService } from '../core/services/seda.service' ;
8686import { NgxUiLoaderService } from 'ngx-ui-loader' ;
8787import { tap } from 'rxjs/operators' ;
88+ import { ProfileType } from '../models/profile-type.enum' ;
89+ import { ProfileVersion } from '../models/profile-version.enum' ;
8890
8991@Component ( {
9092 selector : 'app-home' ,
@@ -139,7 +141,9 @@ export class MainComponent implements OnInit, OnDestroy {
139141 // Check for query params to create a new profile
140142 this . route . queryParams . subscribe ( ( queryParams ) => {
141143 if ( queryParams [ 'type' ] && queryParams [ 'version' ] ) {
142- this . createNewProfile ( queryParams [ 'type' ] , queryParams [ 'version' ] ) ;
144+ const type : ProfileType = queryParams ?. type ;
145+ const version : ProfileVersion = queryParams ?. version ;
146+ this . createNewProfile ( type , version ) ;
143147 } else {
144148 // No valid params, redirect to list
145149 this . router . navigate ( [ '/' ] , { skipLocationChange : false } ) ;
@@ -212,10 +216,10 @@ export class MainComponent implements OnInit, OnDestroy {
212216 } ) ;
213217 }
214218
215- private createNewProfile ( profileType : string , profileVersion : string ) {
219+ private createNewProfile ( profileType : ProfileType , profileVersion : ProfileVersion ) {
216220 this . loaderService . start ( ) ;
217221 this . profileService
218- . createProfile ( '/pastis/profile' , profileType as any , profileVersion as any )
222+ . createProfile ( profileType , profileVersion )
219223 . pipe (
220224 tap ( ( profileResponse ) => {
221225 this . uploadedProfileResponse = profileResponse ;
0 commit comments