Vendor app Client: Maiora
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 4 година
пре 4 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { Injectable } from '@angular/core';
  2. import { URL } from '../data/url';
  3. import { HttpClient, HttpHeaders } from '@angular/common/http';
  4. @Injectable({
  5. providedIn: 'root'
  6. })
  7. export class ItemService {
  8. constructor(
  9. private http: HttpClient
  10. ) { }
  11. updateMenuItem(menuItem: any, outlet_id: string | number) {
  12. menuItem.outlet = {
  13. outlet_id: outlet_id
  14. };
  15. const httpOptions = {
  16. headers: new HttpHeaders({
  17. 'Access-Control-Allow-Origin': '*',
  18. 'Content-Type': 'application/json',
  19. 'Authorization': 'Bearer ' + localStorage.token
  20. })
  21. };
  22. return this.http.put(URL + '/api/maioraservice/menuitems/v1/update/', menuItem, httpOptions).toPromise();
  23. }
  24. addMenuItem(menuItem: any, outlet_id: number) {
  25. menuItem.outlet = {
  26. outlet_id: outlet_id
  27. };
  28. console.log(menuItem);
  29. const httpOptions = {
  30. headers: new HttpHeaders({
  31. 'Access-Control-Allow-Origin': '*',
  32. 'Content-Type': 'application/json',
  33. 'Authorization': 'Bearer ' + localStorage.token
  34. })
  35. };
  36. return this.http.post(URL + '/api/maioraservice/menuitems/v1/create/', menuItem, httpOptions).toPromise();
  37. }
  38. }