<commit_before>import {Component} from 'angular2/core';
import {Router, RouteParams} from 'angular2/router';
import {HTTP_PROVIDERS}	from 'angular2/http';
import {UserService}	from '../../../shared/services/user.service';
import {Token}          from '../../../shared/models/token';
import {User}           from '../../../shared/models/user';

@Component({
	selector: 'login',
	templateUrl: './pages/login-twitter/components/login.twitter.html',
	providers: [HTTP_PROVIDERS,UserService]
})

export class LoginTwitterCmp {
	errorMessage: string;
	datam: Token;
	user:User;
	constructor( private _router: Router, private _params:RouteParams, private _userService: UserService) {
	}

	ngOnInit() {
		var oauth_token = this._params.get('oauth_token');
		var oauth_verifier = this._params.get('oauth_verifier');

		this._userService.loginWithTwitter(oauth_token, oauth_verifier).subscribe(
						body => this.test(body),
                       error =>  this.errorMessage = <any>error,
                       ()=>this.getUser());

    }

   	test(body) {
		this.datam = body;
		localStorage.setItem('token', this.datam.token);
	}

    getUser() {
		this._userService.getUser()
   				.subscribe(
   					user => this.assignObj(user),
   					error =>  this.errorMessage = <any>error,
   					()=>this._router.navigate(['Dashboard']));
	}

	assignObj(user) {
		this.user = user;
		console.log('assignObj:' + this.user.username);
		localStorage.setItem('connectedUserName', this.user.username);
    }
}<commit_msg>Fixed unwanted query string problem after redirecting to dashboard<commit_after>import {Component} from 'angular2/core';
import {Router, RouteParams} from 'angular2/router';
import {HTTP_PROVIDERS}	from 'angular2/http';
import {UserService}	from '../../../shared/services/user.service';
import {Token}          from '../../../shared/models/token';
import {User}           from '../../../shared/models/user';

@Component({
	selector: 'login',
	templateUrl: './pages/login-twitter/components/login.twitter.html',
	providers: [HTTP_PROVIDERS,UserService]
})

export class LoginTwitterCmp {
	errorMessage: string;
	datam: Token;
	user:User;
	constructor( private _router: Router, private _params:RouteParams, private _userService: UserService) {
	}

	ngOnInit() {
		var oauth_token = this._params.get('oauth_token');
		var oauth_verifier = this._params.get('oauth_verifier');

		this._userService.loginWithTwitter(oauth_token, oauth_verifier).subscribe(
						body => this.test(body),
                       error =>  this.errorMessage = <any>error,
                       ()=>this.getUser());

    }

   	test(body) {
		this.datam = body;
		localStorage.setItem('token', this.datam.token);
	}

    getUser() {
		this._userService.getUser()
   				.subscribe(
   					user => this.assignObj(user),
   					error =>  this.errorMessage = <any>error,
   					()=>location.href=location.origin+location.pathname+'#dashboard');
	}

	assignObj(user) {
		this.user = user;
		console.log('assignObj:' + this.user.username);
		localStorage.setItem('connectedUserName', this.user.username);
    }
}
{'fraction_non_alphanumeric': 0.1562601099967648, 'fraction_numerical': 0.0019411193788417987, 'mean_word_length': 3.494186046511628, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, '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': '409841', 'n_tokens_mistral': 1047, 'n_tokens_neox': 982, 'n_words': 178}