Add material code and settings
This commit is contained in:
parent
36be0426f6
commit
498bcf1c24
9 changed files with 279 additions and 60 deletions
41
client/src/app/core/services/material.service.ts
Normal file
41
client/src/app/core/services/material.service.ts
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MaterialCode, MaterialSetting } from '../models/recipe.model';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class MaterialService {
|
||||
constructor(private _httpClient: HttpClient) {}
|
||||
|
||||
getMaterialCodes(
|
||||
matIds?: number[],
|
||||
version?: string
|
||||
): Observable<MaterialCode[]> {
|
||||
return this._httpClient.get<MaterialCode[]>(
|
||||
`${environment.api}/materials/code`,
|
||||
{
|
||||
params: {
|
||||
version: version || '',
|
||||
mat_ids: matIds?.join(',') || '',
|
||||
},
|
||||
withCredentials: true,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
getMaterialSettingById(
|
||||
id: number,
|
||||
version?: string
|
||||
): Observable<MaterialSetting> {
|
||||
return this._httpClient.get<MaterialSetting>(
|
||||
`${environment.api}/materials/setting/${id}`,
|
||||
{
|
||||
params: {
|
||||
version: version || '',
|
||||
},
|
||||
withCredentials: true,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue