import { Injectable } from '@angular/core';
import {HttpClient} from  '@angular/common/http';
import {CommonsService} from './commons.service';
import {environment} from '../../environments/environment';

@Injectable({
  providedIn: 'root'
})
export class CompanyTwoPwdService {

  constructor(
      private http: HttpClient,
      private common: CommonsService
  ) { }

  /**
   * 是否设置二级密码
   *
   * @param  paramsObject   参数对象
   * @param  callBack   回调
   */
  public isSetTwoPwd(callBack) {
    this.http.post(environment.baseUrl + 'companyTwoPwd/isSetTwoPwd', null).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 设置二级密码
   *
   * @param  paramsObject   参数对象
   * @param  callBack   回调
   */
  public setTwoPwd(paramsObject: object, callBack) {
    this.http.post(environment.baseUrl + 'companyTwoPwd/setTwoPwd', paramsObject).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 修改二级密码
   *
   * @param  paramsObject   参数对象
   * @param  callBack   回调
   */
  public updateTwoPwd(paramsObject: object, callBack) {
    this.http.post(environment.baseUrl + 'companyTwoPwd/updateTwoPwd', paramsObject).subscribe(data => {
      callBack(data);
    });
  }
}
