2021-04-30 15:47:39 +02:00

33 lines
891 B
TypeScript

import { Component, OnInit } from '@angular/core';
import {AuthService} from '../../services/auth.service';
import {HttpClient, HttpHeaders} from '@angular/common/http';
@Component({
selector: 'app-tweets',
templateUrl: './tweets.component.html',
styleUrls: ['./tweets.component.css']
})
export class TweetsComponent implements OnInit {
constructor(private http: HttpClient,
private authService: AuthService) { }
ngOnInit(): void {
}
loadMore() {
console.log('TODO: Implement');
const headerDict = {
'Authorization': 'Bearer ' + this.authService.getToken(),
};
return this.http.get('http://localhost:8000/api/login',
{
headers: new HttpHeaders(headerDict),
observe: 'response',
})
.subscribe(data => { console.log(data); alert('Returned with code: ' + data['status']); });
}
}