
import { Injectable } from '@angular/core';
import { Http, Headers, RequestOptions } from '@angular/http';
import { NavController, LoadingController, ToastController } from 'ionic-angular';
import 'rxjs/add/operator/map';
import { HomePage } from '../../pages/home/home';
import { LoginPage } from '../../pages/login/login';

let apiUrl = 'http://apollodec.com/SIT/api/';

@Injectable()
export class AuthServiceProvider {
public commonUrl : any;
public studentStatus : any;
  constructor( public http: Http,private RequestOptions:RequestOptions) {
    this.commonUrl = 'http://apollodec.com/SIT/';
  }
 
   
  
  login(credentials) {
    
    let headers = new Headers({ 'Content-Type': 'application/json' });
    let options = new RequestOptions({ headers: headers });
      return this.http.post(apiUrl+'login/', JSON.stringify(credentials), options)
       .map(res => res.json())
       
  }
 
  studentGetInfo(Requested){
    //console.log("pro"+Requested);
    let headers = new Headers({ 'Content-Type': 'application/json' });
    let options = new RequestOptions({ headers: headers });
    return this.http.post(apiUrl+'getStudentBasicInfo/',JSON.stringify(Requested),options)
    .map(res => res.json())
  }
  
  getAnnouncement(){
    //console.log("pro"+Requested);
    let accn = {};
    let headers = new Headers({ 'Content-Type': 'application/json' });
    let options = new RequestOptions({ headers: headers });
    return this.http.post(apiUrl+'getLoginAnnouncementDetails/',JSON.stringify(accn),options)
    .map(res => res.json())
  }
 }
