diff --git a/backend/app_be/models.py b/backend/app_be/models.py index 68eb58d..0695a44 100644 --- a/backend/app_be/models.py +++ b/backend/app_be/models.py @@ -23,4 +23,4 @@ class Tweet(models.Model): icon = models.ForeignKey(Icon, on_delete=models.CASCADE) text = models.CharField(max_length=137) date_time = models.DateTimeField() - url = models.CharField(max_length=100) \ No newline at end of file + url = models.CharField(max_length=100) diff --git a/backend/app_be/urls.py b/backend/app_be/urls.py index 34cba2c..ab946a3 100644 --- a/backend/app_be/urls.py +++ b/backend/app_be/urls.py @@ -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() diff --git a/backend/app_be/views/rest_api.py b/backend/app_be/views/rest_api.py index 0936875..17a0c4b 100644 --- a/backend/app_be/views/rest_api.py +++ b/backend/app_be/views/rest_api.py @@ -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) \ No newline at end of file + return JsonResponse({[{"asdf", "asdf", "sdfasdf", "asdf"}, {"asdf", "asdf", "sdfasdf", "asdf"}]}, safe=False, + status=200) diff --git a/backend/app_be/views/twitter.py b/backend/app_be/views/twitter.py index b643389..cfcea34 100644 --- a/backend/app_be/views/twitter.py +++ b/backend/app_be/views/twitter.py @@ -42,7 +42,6 @@ class twitter_bot: while True: # Search RSS Feed - time.sleep(60.0 - ((time.time() - starttime) % 60.0)) diff --git a/frontend/src/app/component/tweets/tweets.component.ts b/frontend/src/app/component/tweets/tweets.component.ts index 1be4041..e5d58e4 100644 --- a/frontend/src/app/component/tweets/tweets.component.ts +++ b/frontend/src/app/component/tweets/tweets.component.ts @@ -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']); + }); } + + +} diff --git a/frontend/src/app/interfaces/interface.ts b/frontend/src/app/interfaces/interface.ts index 60cbb9d..9bd7478 100644 --- a/frontend/src/app/interfaces/interface.ts +++ b/frontend/src/app/interfaces/interface.ts @@ -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; }