Fix: Login deleting old clients was conflicting with login history
Chore: Moved to angular linting using the recommended plugins / settings
This commit is contained in:
@@ -7,9 +7,6 @@ import { ErrorLoggerService } from '../core/error-logger.service';
|
||||
|
||||
import { Role } from './role';
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({ 'Content-Type': 'application/json' }),
|
||||
};
|
||||
const url = '/api/roles';
|
||||
const serviceName = 'RoleService';
|
||||
|
||||
@@ -21,35 +18,27 @@ export class RoleService {
|
||||
|
||||
get(id: string | null): Observable<Role> {
|
||||
const getUrl: string = id === null ? `${url}` : `${url}/${id}`;
|
||||
return <Observable<Role>>(
|
||||
this.http
|
||||
.get<Role>(getUrl)
|
||||
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`)))
|
||||
);
|
||||
return this.http
|
||||
.get<Role>(getUrl)
|
||||
.pipe(catchError(this.log.handleError(serviceName, `get id as Observable<Role>=${id}`))) as Observable<Role>;
|
||||
}
|
||||
|
||||
list(): Observable<Role[]> {
|
||||
return <Observable<Role[]>>(
|
||||
this.http
|
||||
.get<Role[]>(`${url}/list`)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'list')))
|
||||
);
|
||||
return this.http
|
||||
.get<Role[]>(`${url}/list`)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'list'))) as Observable<Role[]>;
|
||||
}
|
||||
|
||||
save(role: Role): Observable<Role> {
|
||||
return <Observable<Role>>(
|
||||
this.http
|
||||
.post<Role>(`${url}`, role, httpOptions)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'save')))
|
||||
);
|
||||
return this.http
|
||||
.post<Role>(`${url}`, role)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'save'))) as Observable<Role>;
|
||||
}
|
||||
|
||||
update(role: Role): Observable<Role> {
|
||||
return <Observable<Role>>(
|
||||
this.http
|
||||
.put<Role>(`${url}/${role.id}`, role, httpOptions)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'update')))
|
||||
);
|
||||
return this.http
|
||||
.put<Role>(`${url}/${role.id}`, role)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'update'))) as Observable<Role>;
|
||||
}
|
||||
|
||||
saveOrUpdate(role: Role): Observable<Role> {
|
||||
@@ -60,10 +49,8 @@ export class RoleService {
|
||||
}
|
||||
|
||||
delete(id: string): Observable<Role> {
|
||||
return <Observable<Role>>(
|
||||
this.http
|
||||
.delete<Role>(`${url}/${id}`, httpOptions)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'delete')))
|
||||
);
|
||||
return this.http
|
||||
.delete<Role>(`${url}/${id}`)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'delete'))) as Observable<Role>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user