order.service.ts (526B)
1 import { HttpClient } from '@angular/common/http'; 2 import { inject, Injectable } from '@angular/core'; 3 import { Observable } from 'rxjs'; 4 5 @Injectable({ 6 providedIn: 'root', 7 }) 8 export class OrderService { 9 private http = inject(HttpClient); 10 11 createOrder(orderRequest: CreateOrderRequest): Observable<{ success: boolean; order?: OrderResponse; error?: string; details?: string }> { 12 return this.http.post<{ success: boolean; order?: OrderResponse; error?: string; details?: string }>('/api/orders', orderRequest); 13 } 14 }