Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export class ApiService {
- constructor(public http: Http) { }
- put(controller: string, method: string, data: Object) {
- return this.http.put("http://127.0.0.1:8000",
- JSON.stringify(data), {
- })
- .map(res => res.json())
- .catch(err => {
- return Observable.throw(err.json());
- });
- }
- }
- export class AccountService {
- api: ApiService;
- constructor() {
- this.api = new ApiService();
- }
- login(username: string, password: string) {
- return this.api.put("accounts", "login", { username: username, password: password});
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement