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
984 B

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