add filter with material
This commit is contained in:
parent
5b01f1c431
commit
70cfd89fc4
9 changed files with 135 additions and 14 deletions
|
|
@ -17,8 +17,8 @@ export class MaterialService {
|
|||
`${environment.api}/materials/code`,
|
||||
{
|
||||
params: {
|
||||
country: country || '',
|
||||
filename: filename || '',
|
||||
country: country || this.getCurrentCountry(),
|
||||
filename: filename || this.getCurrentFile(),
|
||||
mat_ids: matIds?.join(',') || '',
|
||||
},
|
||||
withCredentials: true,
|
||||
|
|
@ -35,11 +35,29 @@ export class MaterialService {
|
|||
`${environment.api}/materials/setting/${id}`,
|
||||
{
|
||||
params: {
|
||||
country: country || '',
|
||||
filename: filename || '',
|
||||
country: country || this.getCurrentCountry(),
|
||||
filename: filename || this.getCurrentFile(),
|
||||
},
|
||||
withCredentials: true,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
getCurrentFile(): string {
|
||||
const currentRecipeFile = localStorage.getItem('currentRecipeFile');
|
||||
if (currentRecipeFile) {
|
||||
return currentRecipeFile;
|
||||
}
|
||||
|
||||
return 'coffeethai02_580.json';
|
||||
}
|
||||
|
||||
getCurrentCountry(): string {
|
||||
const currentRecipeCountry = localStorage.getItem('currentRecipeCountry');
|
||||
if (currentRecipeCountry) {
|
||||
return currentRecipeCountry;
|
||||
}
|
||||
|
||||
return 'Thailand';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import { RecipeMetaData } from 'src/app/shared/types/recipe';
|
|||
interface RecipeParams {
|
||||
filename: string;
|
||||
country: string;
|
||||
materialIds: number[];
|
||||
offset: number;
|
||||
take: number;
|
||||
search: string;
|
||||
|
|
@ -31,6 +32,7 @@ export class RecipeService {
|
|||
search: '',
|
||||
country: this.getCurrentCountry(),
|
||||
filename: this.getCurrentFile(),
|
||||
materialIds: [],
|
||||
}
|
||||
): Observable<{
|
||||
fileName: string;
|
||||
|
|
@ -48,6 +50,7 @@ export class RecipeService {
|
|||
search: params.search,
|
||||
country: params.country,
|
||||
filename: params.filename,
|
||||
material_ids: params.materialIds.join(','),
|
||||
},
|
||||
withCredentials: true,
|
||||
responseType: 'json',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue