mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
34 lines
851 B
TypeScript
34 lines
851 B
TypeScript
|
|
import { Injectable } from '@angular/core';
|
||
|
|
import { StorageService } from './storage.service';
|
||
|
|
import { HttpService } from './http.service';
|
||
|
|
import { Router } from '@angular/router';
|
||
|
|
import { Observable } from 'rxjs';
|
||
|
|
import { AuthConnstants } from '../config/auth-constants';
|
||
|
|
|
||
|
|
@Injectable({
|
||
|
|
providedIn: 'root'
|
||
|
|
})
|
||
|
|
export class AuthService {
|
||
|
|
|
||
|
|
constructor(
|
||
|
|
private httpService: HttpService,
|
||
|
|
private storageService: StorageService,
|
||
|
|
private router: Router
|
||
|
|
) { }
|
||
|
|
|
||
|
|
login(postData: any): Observable<any> {
|
||
|
|
return this.httpService.post('login', postData);
|
||
|
|
}
|
||
|
|
|
||
|
|
signup(postData: any): Observable<any> {
|
||
|
|
return this.httpService.post('signup', postData);
|
||
|
|
}
|
||
|
|
|
||
|
|
logout(){
|
||
|
|
this.storageService.removeStorageItem(AuthConnstants.AUTH).then(res =>{
|
||
|
|
this.router.navigate([''])
|
||
|
|
})
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|