Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {Injectable} from 'angular2/core';
- import {Http} from 'angular2/http';
- import 'rxjs/Rx';
- import {Storage, LocalStorage, Events} from 'ionic-angular';
- const SERVER_URL = 'http://mindlydk.ps3.dev.infoproducts.dk';
- @Injectable()
- export class UserData {
- constructor(private http: Http, private events: Events) {
- }
- login(email, password) {
- var postData = JSON.stringify({
- email: email,
- password: password
- });
- return this.http.post(SERVER_URL + '/api/login.json', postData)
- .toPromise()
- .then(response => {
- return response.json();
- }, this.handleError);
- }
- logout() {
- this.events.publish('user:logout');
- }
- resetPassword(email) {
- }
- isLoggedIn() {
- }
- handleError(error) {
- console.log(error);
- return error.json().message || 'Server error, please try again later';
- }
- }
Add Comment
Please, Sign In to add comment