<commit_before>import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {HttpClient} from '@angular/common/http';

@Component({
  selector: 'app-admin-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})
export class AdminLoginComponent implements OnInit {

  @Output()
  loginOutput: EventEmitter<string> = new EventEmitter();

  constructor(private http: HttpClient) { }

  ngOnInit() {
  }

  submitLogin(name: string, password: string) {
    console.log('admin login', name, password);
    this.http.post('/api/admin/session/', {username: name, password: password}).subscribe(
      (data) => {
        console.log('loginPost data', data);
        this.loginOutput.emit(data['token']);
      },
      (err) => {
        console.log('loginPost error', err);
      }
    );
  }
}<commit_msg>added error message for admin login<commit_after>import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {MatSnackBar} from '@angular/material';

@Component({
  selector: 'app-admin-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})
export class AdminLoginComponent implements OnInit {

  @Output()
  loginOutput: EventEmitter<string> = new EventEmitter();

  constructor(private http: HttpClient, public snackBar: MatSnackBar) { }

  ngOnInit() {
  }

  submitLogin(name: string, password: string) {
    console.log('admin login', name, password);
    this.http.post('/api/admin/session/', {username: name, password: password}).subscribe(
      (data) => {
        console.log('loginPost data', data);
        this.loginOutput.emit(data['token']);
      },
      (err) => {
        this.snackBar.open('Wrong Username or Password',null, {
          duration: 2000,
          horizontalPosition: 'center'
        });
        console.log('loginPost error', err);
      }
    );
  }
}
{'fraction_non_alphanumeric': 0.15792181069958847, 'fraction_numerical': 0.00205761316872428, 'mean_word_length': 3.609004739336493, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7141031', 'n_tokens_mistral': 588, 'n_tokens_neox': 580, 'n_words': 128}