Skip to content

Commit 055ffc4

Browse files
author
Lazhari
committed
Update the services and models
1 parent 1e4b983 commit 055ffc4

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

src/app/models/contacts-response.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export class ContactsResponse {
2+
}

src/app/models/user.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Name {
2+
first: string;
3+
last: string;
4+
}
5+
export class User {
6+
guid: string;
7+
isActive: boolean;
8+
balance: string;
9+
picture: string;
10+
age: number;
11+
eyeColor: string;
12+
name: Name;
13+
company: string;
14+
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { TestBed, inject } from '@angular/core/testing';
2+
3+
import { UsersService } from './users.service';
4+
5+
describe('UsersService', () => {
6+
beforeEach(() => {
7+
TestBed.configureTestingModule({
8+
providers: [UsersService]
9+
});
10+
});
11+
12+
it('should be created', inject([UsersService], (service: UsersService) => {
13+
expect(service).toBeTruthy();
14+
}));
15+
});

src/app/services/users.service.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Injectable } from '@angular/core';
2+
import { HttpClient } from '@angular/common/http';
3+
4+
import { Observable } from 'rxjs/Observable';
5+
import { of } from 'rxjs/observable/of';
6+
@Injectable()
7+
export class UsersService {
8+
9+
constructor(private http: HttpClient) {
10+
11+
}
12+
getUsers(): Observable<any> {
13+
const url: string = 'https://mini-crm-api.herokuapp.com/api/v1/contacts';
14+
return this.http.get<any>(url);
15+
}
16+
}

0 commit comments

Comments
 (0)