<commit_before>import {Component, OnInit} from '@angular/core';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import {ActivatedRoute, Params, Router} from '@angular/router';
import {UserService} from '../../user/user.service';


@Component({
  providers: [
    UserService
  ],
  template: ''
})
export class Oauth2LoginComponent implements OnInit {

  state: string;

  constructor(private route: ActivatedRoute,
              private router: Router,
              private user: UserService) {
  }

  ngOnInit() {
    this.route.queryParams.subscribe(
      (params: Params) => {
        const authorization = params['authorization'];
        this.findAccessToken(authorization);
      }
    );
  }

  findAccessToken(authorization: string) {
    if (authorization != null) {
      localStorage.setItem('authorization', 'Bearer ' + authorization);
    }
    authorization = localStorage.getItem('authorization');
    if (authorization == null) {
      this.router.navigate(['oauth2', 'redirect']);
      return;
    } else {
      this.user.checkin(authorization).subscribe(
        user => console.log(user)
      );
    }
  }

}<commit_msg>fix bug<commit_after>import {Component, OnInit} from '@angular/core';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import {ActivatedRoute, Params, Router} from '@angular/router';
import {UserService} from '../../user/user.service';


@Component({
  providers: [
    UserService
  ],
  template: ''
})
export class Oauth2LoginComponent implements OnInit {

  state: string;

  constructor(private route: ActivatedRoute,
              private router: Router,
              private user: UserService) {
  }

  ngOnInit() {
    this.route.queryParams.subscribe(
      (params: Params) => {
        const authorization = params['authorization'];
        this.findAccessToken(authorization);
      }
    );
  }

  findAccessToken(authorization: string) {
    if (authorization != null) {
      localStorage.setItem('authorization', 'Bearer ' + authorization);
    }
    authorization = localStorage.getItem('authorization');
    if (authorization == null) {
      this.router.navigate(['oauth2', 'redirect']);
      return;
    } else {
      this.user.visit(authorization).subscribe(
        user => console.log(user)
      );
    }
  }

}
{'fraction_non_alphanumeric': 0.1371872303710095, 'fraction_numerical': 0.001725625539257981, 'mean_word_length': 3.1117021276595747, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3516706', 'n_tokens_mistral': 689, 'n_tokens_neox': 677, 'n_words': 135}