All Masters Done!!

This commit is contained in:
2020-06-15 21:40:12 +05:30
parent fdfd3dcbfb
commit 938bb67e0a
33 changed files with 1082 additions and 765 deletions

View File

@ -8,7 +8,7 @@ import { Table } from '../core/table';
const httpOptions = {
headers: new HttpHeaders({'Content-Type': 'application/json'})
};
const url = '/v1/tables';
const url = '/api/tables';
const serviceName = 'TableService';
@Injectable({
@ -19,7 +19,7 @@ export class TableService {
}
get(id: string): Observable<Table> {
const getUrl: string = (id === null) ? `${url}/new` : `${url}/${id}`;
const getUrl: string = (id === null) ? url : `${url}/${id}`;
return <Observable<Table>>this.http.get<Table>(getUrl)
.pipe(
catchError(this.log.handleError(serviceName, `get id=${id}`))
@ -27,23 +27,21 @@ export class TableService {
}
list(): Observable<Table[]> {
const options = {params: new HttpParams().set('l', '')};
return <Observable<Table[]>>this.http.get<Table[]>(url, options)
return <Observable<Table[]>>this.http.get<Table[]>(`${url}/list`)
.pipe(
catchError(this.log.handleError(serviceName, 'list'))
);
}
running(): Observable<Table[]> {
const options = {params: new HttpParams().set('r', '')};
return <Observable<Table[]>>this.http.get<Table[]>(url, options)
return <Observable<Table[]>>this.http.get<Table[]>(`${url}/running`)
.pipe(
catchError(this.log.handleError(serviceName, 'running'))
);
}
save(tables: Table): Observable<Table> {
return <Observable<Table>>this.http.post<Table>(`${url}/new`, tables, httpOptions)
return <Observable<Table>>this.http.post<Table>(url, tables, httpOptions)
.pipe(
catchError(this.log.handleError(serviceName, 'save'))
);
@ -57,7 +55,7 @@ export class TableService {
}
updateSortOrder(list: Table[]): Observable<boolean> {
return <Observable<boolean>>this.http.post<Table[]>(url, list, httpOptions)
return <Observable<boolean>>this.http.post<Table[]>(`${url}/list`, list, httpOptions)
.pipe(
catchError(this.log.handleError(serviceName, 'updateSortOrder'))
);