reformat code
This commit is contained in:
parent
b703757621
commit
b96a8d35c5
@ -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()
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -42,7 +42,6 @@ class twitter_bot:
|
||||
while True:
|
||||
# Search RSS Feed
|
||||
|
||||
|
||||
time.sleep(60.0 - ((time.time() - starttime) % 60.0))
|
||||
|
||||
|
||||
|
||||
@ -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']);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user