import { Component, OnInit } from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import { PagesComponent } from 'app/pages/pages.component';

import * as AuthStore from '../../store/auth';
import { Member } from '../../model';
import { AuthSelector } from '../../store';
import { Store } from '@ngrx/store';
import {FormBuilder, FormGroup} from '@angular/forms';


@Component({
  selector: 'of-member-profile',
  templateUrl: './profile.component.html',
  styleUrls: ['./profile.component.scss']
})
export class ProfileComponent implements OnInit {

  member: Member;
  modifyForm: FormGroup;

  constructor(
    public app: PagesComponent,
    private activatedRoute: ActivatedRoute,
    private router: Router,
    private store: Store<AuthStore.State>,
    private formBuilder: FormBuilder,
  ) {
  }


  ngOnInit() {
    this.store.select(AuthSelector.select('member')).subscribe(
      (member: Member) => {
        this.member = member;
      },
      (error) => {
        console.log(error);
      }
    );
    this.initForm();
  }

  initForm() {
    this.modifyForm = this.formBuilder.group({

    });
  }

  modifyProfile() {
    console.log('clicked');
  }

}
