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.
64 lines
1.6 KiB
64 lines
1.6 KiB
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 {ResetpwdResponse} from '../../interface/Response';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
/**
|
|
* 重置密码服务
|
|
*/
|
|
export class ResetpwdService extends JSONRequest {
|
|
|
|
constructor(
|
|
private http: HttpClient
|
|
) {
|
|
super();
|
|
}
|
|
|
|
/**
|
|
* 检查邮箱
|
|
*/
|
|
checkEmail(body): Observable<ResetpwdResponse> {
|
|
return this.http.post<ResetpwdResponse>(HttpInterface.checkEmail, body, this.httpOptions)
|
|
.pipe(
|
|
catchError(this.handleError<any>('检查邮箱'))
|
|
);
|
|
}
|
|
|
|
/**
|
|
* 发送验证码
|
|
*/
|
|
sendCode(body): Observable<ResetpwdResponse> {
|
|
return this.http.post<ResetpwdResponse>(HttpInterface.sendCode, body, this.httpOptions)
|
|
.pipe(
|
|
catchError(this.handleError<any>('发送验证码'))
|
|
);
|
|
}
|
|
|
|
/**
|
|
* 检查验证码
|
|
* @param body 表单值
|
|
*/
|
|
checkCode(body): Observable<ResetpwdResponse> {
|
|
return this.http.post<ResetpwdResponse>(HttpInterface.checkCode, body, this.httpOptions)
|
|
.pipe(
|
|
catchError(this.handleError<any>('检查验证码'))
|
|
);
|
|
}
|
|
|
|
/**
|
|
* 重置密码
|
|
*/
|
|
resetPwd(body): Observable<ResetpwdResponse> {
|
|
return this.http.post<ResetpwdResponse>(HttpInterface.resetPwd, body, this.httpOptions)
|
|
.pipe(
|
|
catchError(this.handleError<any>('重置密码'))
|
|
);
|
|
}
|
|
|
|
}
|
|
|