update recipe model

This commit is contained in:
Kenta420-Poom 2023-09-21 17:28:37 +07:00
parent 8228a4f46c
commit b681a5a9af
7 changed files with 301 additions and 114 deletions

View file

@ -1,16 +0,0 @@
import { Injectable } from '@angular/core';
@Injectable({ providedIn: 'root' })
export class JwtService {
getToken(): string | null {
return window.localStorage['jwtToken'];
}
saveToken(token: string): void {
window.localStorage['jwtToken'] = token;
}
destroyToken(): void {
window.localStorage.removeItem('jwtToken');
}
}

View file

@ -0,0 +1,16 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable, distinctUntilChanged } from 'rxjs';
import { Recipe } from '../models/recipe.model';
import { environment } from 'src/environments/environment';
@Injectable({ providedIn: 'root' })
export class RecipeService {
constructor(private _httpClient: HttpClient) {}
getRecipes(): Observable<Recipe> {
return this._httpClient.get<Recipe>(environment.api + '/recipes', {
withCredentials: true,
});
}
}