import { Injectable } from '@angular/core' ; import { HttpClient } from '@angular/common/http' ; interface myData { success : boolean ; message : string ; } @ Injectable ( ) export class AuthService { private loggedInStatus = false ; constructor ( private http ) { } setLoggedIn ( value ) { this . loggedInStatus = value ; } get isLoggedIn ( ) { return this . loggedInStatus ; } getUserDetails ( username , password ) { return this . http . post < myData > ( '/api/auth.php' , { username , password } ) ; } }