reformat code

This commit is contained in:
Manuel Hude 2021-05-02 10:54:38 +02:00
parent b703757621
commit b96a8d35c5
6 changed files with 28 additions and 24 deletions

View File

@ -24,7 +24,7 @@ urlpatterns = [
path('admin/', admin.site.urls),
url(r'^api/login', LoginClass.login),
url(r'^getSixTweets', TwitterClass.getLastSixTweets),
url(r'^getTweleveTweets',TwitterClass.getLastSixTweets)
url(r'^getTwelveTweets', TwitterClass.getLastSixTweets)
]
router = DefaultRouter()

View File

@ -51,8 +51,10 @@ class LoginClass:
return JsonResponse({'user': user_sub}, safe=False, status=200)
class TwitterClass:
@staticmethod
@api_view(['GET'])
def getLastSixTweets():
return JsonResponse({[{"asdf","asdf","sdfasdf","asdf"},{"asdf","asdf","sdfasdf","asdf"}]}, safe=False, status=200)
return JsonResponse({[{"asdf", "asdf", "sdfasdf", "asdf"}, {"asdf", "asdf", "sdfasdf", "asdf"}]}, safe=False,
status=200)

View File

@ -42,7 +42,6 @@ class twitter_bot:
while True:
# Search RSS Feed
time.sleep(60.0 - ((time.time() - starttime) % 60.0))

View File

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {AuthService} from '../../services/auth.service';
import {HttpClient, HttpHeaders} from '@angular/common/http';
@ -13,29 +13,32 @@ class Tweet {
})
export class TweetsComponent implements OnInit {
tweets:Tweet[] = [];
tweets: Tweet[] = [];
constructor(private http: HttpClient,
private authService: AuthService) { }
private authService: AuthService) {
}
ngOnInit(): void {
}
loadMore() {
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']); });
}
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']);
});
}
}

View File

@ -9,9 +9,9 @@ export interface WSEvents {
export interface Tweet {
icon: any
text: string
date_time: DateTimeFormat
url: String
icon: any;
text: string;
date_time: DateTimeFormat;
url: String;
}