fix(create-account): Fixed form-submit so it submits correct data and uses correct data to redirect (TV-241)
Squashed commit of the following:
commit 5c0f8d9b86b638801184f38016d16ffce2fddc56
Merge: 76eba37 d91b3e6
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date: Fri Jun 4 09:26:41 2021 +0200
Merged develop and resolved conflicts
commit 76eba37ca12407ba86ae08c8ef7fc06b873286cd
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date: Thu Jun 3 07:46:40 2021 +0200
Added functionality to create account inside mock-api
commit f0af4736b6a196db9a1306ca8b355c62610905ee
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date: Thu Jun 3 06:32:21 2021 +0200
Removed PEGA references from repository
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import { Authorization } from './authorization.model';
|
||||||
|
import { Organization } from './organization.model';
|
||||||
import { Participant } from './participant.model';
|
import { Participant } from './participant.model';
|
||||||
import { Service } from './service.model';
|
import { Service } from './service.model';
|
||||||
import { User, UserApiResponse } from './user.model';
|
import { User, UserApiResponse } from './user.model';
|
||||||
@@ -9,16 +11,31 @@ export interface Employee extends User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface EmployeeApiResponse extends UserApiResponse {
|
export interface EmployeeApiResponse extends UserApiResponse {
|
||||||
services: Service[];
|
|
||||||
languages: string[];
|
languages: string[];
|
||||||
participants: Participant[];
|
participants: Participant[];
|
||||||
|
services: Service[];
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||||
export interface EmployeeApiRequestData extends Employee {}
|
export interface EmployeeApiRequestData {
|
||||||
|
firstName: string;
|
||||||
|
lastName: string;
|
||||||
|
ssn: string;
|
||||||
|
organizations: Organization[];
|
||||||
|
services: Service[];
|
||||||
|
authorizations: Authorization[];
|
||||||
|
}
|
||||||
|
|
||||||
export function mapEmployeeToEmployeeApiRequestData(data: Employee): EmployeeApiRequestData {
|
export function mapEmployeeToEmployeeApiRequestData(data: Employee): EmployeeApiRequestData {
|
||||||
return data;
|
const { firstName, lastName, ssn, services, organizations, authorizations } = data;
|
||||||
|
return {
|
||||||
|
firstName,
|
||||||
|
lastName,
|
||||||
|
ssn,
|
||||||
|
services,
|
||||||
|
organizations,
|
||||||
|
authorizations,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mapEmployeeReponseToEmployee(data: EmployeeApiResponse): Employee {
|
export function mapEmployeeReponseToEmployee(data: EmployeeApiResponse): Employee {
|
||||||
|
|||||||
@@ -41,9 +41,7 @@ export class EmployeeFormComponent {
|
|||||||
private serviceService: ServiceService,
|
private serviceService: ServiceService,
|
||||||
private authorizationService: AuthorizationService,
|
private authorizationService: AuthorizationService,
|
||||||
private router: Router
|
private router: Router
|
||||||
) {
|
) {}
|
||||||
this.formGroup.valueChanges.subscribe(values => console.log(this.formGroup));
|
|
||||||
}
|
|
||||||
|
|
||||||
get firstNameControl(): AbstractControl {
|
get firstNameControl(): AbstractControl {
|
||||||
return this.formGroup.get('firstName');
|
return this.formGroup.get('firstName');
|
||||||
|
|||||||
@@ -69,17 +69,10 @@ export class EmployeeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public postNewEmployee(employeeData: Employee): Observable<string> {
|
public postNewEmployee(employeeData: Employee): Observable<string> {
|
||||||
console.log(employeeData);
|
|
||||||
return;
|
|
||||||
return this.httpClient
|
return this.httpClient
|
||||||
.post<any>(this._employeeApiUrl, mapEmployeeToEmployeeApiRequestData(employeeData), API_HEADERS)
|
.post<any>(this._employeeApiUrl, mapEmployeeToEmployeeApiRequestData(employeeData), API_HEADERS)
|
||||||
.pipe(
|
.pipe(
|
||||||
map(data => {
|
map(({ id }) => id),
|
||||||
if (data.pyHasError === 'true') {
|
|
||||||
throw new Error(data.pyErrorMessage);
|
|
||||||
}
|
|
||||||
return data.pyUserIdentifier;
|
|
||||||
}),
|
|
||||||
catchError(error => throwError({ message: error, type: ErrorType.API }))
|
catchError(error => throwError({ message: error, type: ErrorType.API }))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user