### File

`src/app/user/services/user.service.ts`

### Constructor

`constructor(http: HttpService, actions: UserActions, store: Store)`
Defined in src/app/user/services/user.service.ts:12

### Methods

getOrders
`getOrders()`
Defined in src/app/user/services/user.service.ts:27
Returns: `Observable<Order[]>` *

getOrderDetail
`getOrderDetail(orderNumber: any)`
Defined in src/app/user/services/user.service.ts:40
Parameters : orderNumber Returns: `Observable<Order>` *

getUser
`getUser()`
Defined in src/app/user/services/user.service.ts:52
Returns: `Observable<User>` *

    import { Injectable } from '@angular/core';
    import { HttpService } from '../../core/services/http';
    import { UserActions } from '../actions/user.actions';
    import { Store } from '@ngrx/store';
    import { AppState } from '../../interfaces';
    import { Order } from '../../core/models/order';
    import { Response } from '@angular/http';
    import { User } from '../../core/models/user';
    import { Observable } from 'rxjs/Observable';

    @Injectable()
    export class UserService {

      constructor(
        private http: HttpService,
        private actions: UserActions,
        private store: Store<AppState>
      ) { }

      /**
       *
       *
       * @returns {Observable<Order[]>}
       *
       * @memberof UserService
       */
      getOrders(): Observable<Order[]> {
        return this.http.get('api/orders')
          .map((res: Response) => res.json());
      }

      /**
       *
       *
       * @param {any} orderNumber
       * @returns {Observable<Order>}
       *
       * @memberof UserService
       */
      getOrderDetail(orderNumber): Observable<Order> {
        return this.http.get(`spree/api/v1/orders/${orderNumber}`)
          .map((res: Response) => res.json());
      }

      /**
       *
       *
       * @returns {Observable<User>}
       *
       * @memberof UserService
       */
      getUser(): Observable<User> {
        const user_id = JSON.parse(localStorage.getItem('user')).id;
        return this.http.get(`spree/api/v1/users/${user_id}`)
          .map(res => res.json());
      }

    }

# results matching ""

# No results matching ""