<commit_before>import { Injectable } from '@angular/core';
import { Http, Headers, Response } from '@angular/http';
import { Observable } from 'rxjs';
import C from '../constants';

@Injectable()
export class AuthService {
  public token: string;
  private baseUrl: string = `${C.server}`;

  constructor(private http: Http) {
    if (localStorage.getItem('email-jwt')) {
      this.token = localStorage.getItem('email-jwt');
    }
  }

  login(username: string, password: string): Observable<boolean> {
    return this.http.post(`${this.baseUrl}/auth/login`, { username: username, password: password })
      .map((response: Response) => {
        // login successful if there's a jwt token in the response
        let token = response.json() && response.json().token;
        if (token) {
          this.token = token;
          localStorage.setItem('email-jwt', token);
          return true;
        } else {
          return false;
        }
      });
  }

  signup(username: string, password: string): Observable<any> {
    return this.http.post(`${this.baseUrl}/users`, { username: username, password: password });
  }

  logout(): void {<commit_msg>—Fix delete unnecessary baseURL<commit_after>import { Injectable } from '@angular/core';
import { Http, Headers, Response } from '@angular/http';
import { Observable } from 'rxjs';
import C from '../constants';

@Injectable()
export class AuthService {
  public token: string;

  constructor(private http: Http) {
    if (localStorage.getItem('email-jwt')) {
      this.token = localStorage.getItem('email-jwt');
    }
  }

  login(username: string, password: string): Observable<boolean> {
    return this.http.post(`${C.server}/auth/login`, { username: username, password: password })
      .map((response: Response) => {
        // login successful if there's a jwt token in the response
        let token = response.json() && response.json().token;
        if (token) {
          this.token = token;
          localStorage.setItem('email-jwt', token);
          return true;
        } else {
          return false;
        }
      });
  }

  signup(username: string, password: string): Observable<any> {
    return this.http.post(`${C.server}/users`, { username: username, password: password });
  }

  logout(): void {
{'fraction_non_alphanumeric': 0.14818062253397632, 'fraction_numerical': 0.0, 'mean_word_length': 3.0318021201413425, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '6331253', 'n_tokens_mistral': 656, 'n_tokens_neox': 655, 'n_words': 173}