update recipe now can select recipe file

This commit is contained in:
Kenta420 2023-10-03 15:06:50 +07:00
parent b25c836f0c
commit b5cb469a30
11 changed files with 209 additions and 236173 deletions

View file

@ -145,7 +145,7 @@
<div class="pt-10 sm:ml-64">
<div class="p-2 sm:mt-5 md:mt-12">
<div class="grid grid-cols-1 gap-2 mb-2">
<div class="mb-2">
<router-outlet></router-outlet>
</div>
</div>

View file

@ -5,6 +5,7 @@ import { Recipe, Recipe01 } from '../models/recipe.model';
import { environment } from 'src/environments/environment';
interface RecipeParams {
version: string;
offset: number;
take: number;
search: string;
@ -15,12 +16,19 @@ export class RecipeService {
constructor(private _httpClient: HttpClient) {}
getRecipes(
params: RecipeParams = { take: 10, offset: 0, search: '' }
params: RecipeParams = {
take: 10,
offset: 0,
search: '',
version: 'coffeethai02_580.json',
}
): Observable<{
fileName: string;
recipes: Recipe;
hasMore: boolean;
}> {
return this._httpClient.get<{
fileName: string;
recipes: Recipe;
hasMore: boolean;
}>(environment.api + '/recipes', {
@ -28,6 +36,7 @@ export class RecipeService {
offset: params.offset,
take: params.take,
search: params.search,
version: params.version,
},
withCredentials: true,
responseType: 'json',
@ -40,4 +49,11 @@ export class RecipeService {
responseType: 'json',
});
}
getRecipeVersions(): Observable<string[]> {
return this._httpClient.get<string[]>(
environment.api + '/recipes/versions',
{ withCredentials: true, responseType: 'json' }
);
}
}