You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
pocketcommunityweb/src/app/account/login/login.service.ts

39 lines
989 B

import {Injectable} from '@angular/core';
import {JSONRequest} from '../../interface/JSONRequest';
import {HttpClient} from '@angular/common/http';
import {HttpInterface} from '../../interface/HttpInterface';
import {catchError} from 'rxjs/operators';
import {Observable} from 'rxjs';
import {LoginResponse, LogoutResponse} from '../../interface/Response';
@Injectable({
providedIn: 'root'
})
export class LoginService extends JSONRequest {
constructor(
private http: HttpClient,
) {
super();
}
/**
* 注销登录
*/
logout(body): Observable<LogoutResponse> {
return this.http.post<LogoutResponse>(HttpInterface.logout, body, this.httpOptions)
.pipe(
catchError(this.handleError<any>('注销'))
);
}
/**
* 登陆
*/
login(body): Observable<LoginResponse> {
return this.http.post<LoginResponse>(HttpInterface.login, body, this.httpOptions)
.pipe(
catchError(this.handleError<any>('登陆'))
);
}
}