add filter with material

This commit is contained in:
Kenta420 2023-10-27 16:13:04 +07:00
parent 5b01f1c431
commit 70cfd89fc4
9 changed files with 135 additions and 14 deletions

View file

@ -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';
}
}