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

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

  constructor(private http: HttpClient) {}

  /**
   * @Author Sum1Dream
   * @Name userLogin
   * @Description // 登录
   * @Date 15:52 2024/4/18
   * @Param params
   * @Param callBack
   */
  public userLogin(params: object, callBack:any) {
    this.http.post(environment.baseUrl + 'login/login', params).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * @Author Sum1Dream
   * @Name loginOut
   * @Description // 退出登录
   * @Date 15:52 2024/4/18
   * @Param callBack
   */
  public loginOut(callBack:any) {
    this.http.post(environment.baseUrl + 'login/loginOut', null).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * @Author Sum1Dream
   * @Name sendUserPass
   * @Description // 修改用户密码
   * @Date 15:52 2024/4/18
   * @Param params
   * @Param callBack
   */
  public sendUserPass(params: object, callBack:any) {
    this.http.post(environment.baseUrl + 'secUser/sendUserPass', params).subscribe(data => {
      callBack(data);
    });
  }
}
