import { Injectable } from '@angular/core' ; import { HttpClient } from '@angular/common/http' ; import { Observable } from 'rxjs/Observable' ; interface myData { message : string ; success : boolean ; } interface isLoggedIn { status : boolean ; } interface logoutStatus { success : boolean ; } @ Injectable ( ) export class UserService { constructor ( private http ) { } getSomeData ( ) { return this . http . get < myData > ( '/api/database.php' ) ; } isLoggedIn ( ) { return this . http . get < isLoggedIn > ( '/api/isloggedin.php' ) ; } logout ( ) { return this . http . get < logoutStatus > ( '/api/logout.php' ) ; } }