update recipe model
This commit is contained in:
parent
8228a4f46c
commit
b681a5a9af
7 changed files with 301 additions and 114 deletions
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
16
client/src/app/core/services/recipe.service.ts
Normal file
16
client/src/app/core/services/recipe.service.ts
Normal 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,
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue