import { Component, OnInit } from '@angular/core';
import { MyService } from '../my.service';
import { SettingInfo } from '../../domain/settinginfo';
import { Router } from "@angular/router";

@Component({
  selector: 'ydlife-my-setting',
  templateUrl: './my-setting.component.html',
  styleUrls: ['./my-setting.component.scss']
})

export class MySettingComponent implements OnInit {
  settingInfo: SettingInfo = new SettingInfo();

  constructor(
    private myService: MyService, private router: Router) { }

  ngOnInit() {
    this.mySettingQuery();
  }

  mySettingQuery() {
    const practitionerId = JSON.parse(localStorage.getItem('ydgiCustomerInfo'))['practitionerId'];
    this.myService.mySettingQuery({ practitionerId: practitionerId }).subscribe((res) => {
      if (res['success']) {
        this.settingInfo = res['data'];
      }
    })
  }

  getOut() {
    localStorage.removeItem('ydgiCustomerInfo');
    this.router.navigate(['/login']);
  }

}
