Merge branch 'main' of https://github.com/Poomipat-Ch/taobin_recipe_manager
This commit is contained in:
commit
b7b4bca78e
10 changed files with 214 additions and 77 deletions
|
|
@ -5,7 +5,7 @@ import { DatePipe, NgFor, NgIf } from '@angular/common';
|
|||
import { Recipe, Recipe01 } from 'src/app/core/models/recipe.model';
|
||||
import { RecipeService } from 'src/app/core/services/recipe.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { RecipeModalComponent } from 'src/app/shared/modal/recipe-modal.component';
|
||||
import { RecipeModalComponent } from 'src/app/shared/modal/recipe-details/recipe-modal.component';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import * as lodash from 'lodash';
|
||||
|
||||
|
|
@ -32,7 +32,6 @@ export class DashboardComponent implements OnInit {
|
|||
private offset = 0;
|
||||
private take = 20;
|
||||
private recipeVersionData: string[] = [];
|
||||
private currentRecipeVersion: string = 'coffeethai02_580.json';
|
||||
|
||||
recipeVersion: BehaviorSubject<string> = new BehaviorSubject<string>('');
|
||||
recipeVersion$ = this.recipeVersion.asObservable();
|
||||
|
|
@ -61,7 +60,7 @@ export class DashboardComponent implements OnInit {
|
|||
offset: this.offset,
|
||||
take: this.take,
|
||||
search: this.oldSearchStr,
|
||||
version: this.currentRecipeVersion,
|
||||
version: this._recipeService.getCurrentVersion(),
|
||||
})
|
||||
.subscribe(({ recipes, hasMore, fileName }) => {
|
||||
const { Recipe01, ...recipesWithoutRecipe01 } = recipes;
|
||||
|
|
@ -100,7 +99,7 @@ export class DashboardComponent implements OnInit {
|
|||
offset: this.offset,
|
||||
take: this.take,
|
||||
search: this.oldSearchStr,
|
||||
version: this.currentRecipeVersion,
|
||||
version: this._recipeService.getCurrentVersion(),
|
||||
})
|
||||
.subscribe(({ recipes, hasMore, fileName }) => {
|
||||
const { Recipe01, ...recipesWithoutRecipe01 } = recipes;
|
||||
|
|
@ -139,7 +138,7 @@ export class DashboardComponent implements OnInit {
|
|||
offset: this.offset,
|
||||
take: this.take,
|
||||
search: this.searchStr,
|
||||
version: this.currentRecipeVersion,
|
||||
version: this._recipeService.getCurrentVersion(),
|
||||
})
|
||||
.subscribe(({ recipes, hasMore, fileName }) => {
|
||||
const { Recipe01, ...recipesWithoutRecipe01 } = recipes;
|
||||
|
|
@ -165,7 +164,6 @@ export class DashboardComponent implements OnInit {
|
|||
this.isHasMore = true;
|
||||
this.isLoadMore = false;
|
||||
this.oldSearchStr = '';
|
||||
this.currentRecipeVersion = recipeVersion;
|
||||
|
||||
this._recipeService
|
||||
.getRecipes({
|
||||
|
|
@ -206,7 +204,8 @@ export class DashboardComponent implements OnInit {
|
|||
|
||||
openJsonTab() {
|
||||
window.open(
|
||||
environment.api + `/recipes/${this.currentRecipeVersion}/json`,
|
||||
environment.api +
|
||||
`/recipes/${this._recipeService.getCurrentVersion()}/json`,
|
||||
'_blank'
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue