delete environment.prod.ts;
use environment.ts for location + port;
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {FormGroup, FormBuilder, AbstractControl} from '@angular/forms';
|
||||
import {FileInput, FileValidator} from 'ngx-material-file-input';
|
||||
import {FormGroup, FormBuilder} from '@angular/forms';
|
||||
import {FileValidator} from 'ngx-material-file-input';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {environment} from '../../../../environments/environment';
|
||||
import {throwError} from 'rxjs';
|
||||
@@ -28,8 +28,6 @@ export class EditierenComponent implements OnInit {
|
||||
keywords: String;
|
||||
|
||||
readonly maxSize = 10240;
|
||||
private currentLocation = environment.location;
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private formBuilder: FormBuilder,
|
||||
private http: HttpClient,
|
||||
@@ -55,7 +53,7 @@ export class EditierenComponent implements OnInit {
|
||||
}
|
||||
|
||||
public loadFeed(id) {
|
||||
this.http.get('http://127.0.0.1:8000/feeds/' + id + '/').subscribe(
|
||||
this.http.get('http://' + environment.location + ':' + environment.port + '/feeds/' + id + '/').subscribe(
|
||||
(data: any) => {
|
||||
this.url = data.url;
|
||||
this.active = data.active;
|
||||
@@ -88,7 +86,7 @@ export class EditierenComponent implements OnInit {
|
||||
form.append('icon', feedData.icon._files['0']);
|
||||
}
|
||||
if (this.id == null) {
|
||||
this.http.post('http://127.0.0.1:8000/feeds/', form).subscribe(
|
||||
this.http.post('http://' + environment.location + ':' + environment.port + '/feeds/', form).subscribe(
|
||||
() => {
|
||||
this._snackbar.open('Feed erfolgreich gespeichert!', 'Schließen', {duration: 3000});
|
||||
},
|
||||
@@ -99,7 +97,7 @@ export class EditierenComponent implements OnInit {
|
||||
}
|
||||
);
|
||||
} else {
|
||||
this.http.put('http://127.0.0.1:8000/feeds/' + this.id + '/', form).subscribe(
|
||||
this.http.put('http://' + environment.location + ':' + environment.port + '/feeds/' + this.id + '/', form).subscribe(
|
||||
() => {
|
||||
this._snackbar.open('Feed erfolgreich gespeichert!', 'Schließen', {duration: 3000});
|
||||
},
|
||||
@@ -114,7 +112,7 @@ export class EditierenComponent implements OnInit {
|
||||
|
||||
|
||||
public errorDialog() {
|
||||
const dialogRef = this._dialog.open(DialogComponent, {
|
||||
this._dialog.open(DialogComponent, {
|
||||
data: {
|
||||
title: 'Serverfehler',
|
||||
body: 'Fehler beim Aufruf des Servers',
|
||||
|
||||
@@ -8,6 +8,7 @@ import {FeedService} from '../../services/feed.service';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {DialogComponent} from '../dialog/dialog.component';
|
||||
import {MatDialog} from '@angular/material/dialog';
|
||||
import {environment} from '../../../environments/environment';
|
||||
|
||||
@Component({
|
||||
selector: 'app-einstellungen',
|
||||
@@ -34,7 +35,7 @@ export class EinstellungenComponent implements OnInit {
|
||||
}
|
||||
|
||||
deleteFeed(id: number) {
|
||||
this.http.delete('http://127.0.0.1:8000/feeds/' + id + '/').subscribe(
|
||||
this.http.delete('http://' + environment.location + ':' + environment.port + '/feeds/' + id + '/').subscribe(
|
||||
() => {
|
||||
this._snackbar.open('Feed erfolgreich gelöscht!', 'Schließen', {duration: 3000});
|
||||
this.feeds = this.feeds.filter(feed => feed.id !== id);
|
||||
@@ -69,7 +70,7 @@ export class EinstellungenComponent implements OnInit {
|
||||
|
||||
|
||||
public errorDialog() {
|
||||
const dialogRef = this._dialog.open(DialogComponent, {
|
||||
this._dialog.open(DialogComponent, {
|
||||
data: {
|
||||
title: 'Serverfehler',
|
||||
body: 'Fehler beim Aufruf des Servers',
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {AuthService} from '../../services/auth.service';
|
||||
import {HttpClient, HttpHeaders} from '@angular/common/http';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {FeedService} from '../../services/feed.service';
|
||||
import {IFeed} from '../../interfaces/feed.interface';
|
||||
import {Observable} from 'rxjs';
|
||||
import {Tweet} from "../../interfaces/interface";
|
||||
import {SnackbarService} from "../../services/snackbar.service";
|
||||
import {Tweet} from '../../interfaces/interface';
|
||||
import {SnackbarService} from '../../services/snackbar.service';
|
||||
import {environment} from '../../../environments/environment';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -34,8 +35,8 @@ export class TweetsComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
this.fillTweets()
|
||||
console.log(this.tweets)
|
||||
this.fillTweets();
|
||||
console.log(this.tweets);
|
||||
|
||||
}
|
||||
|
||||
@@ -43,17 +44,19 @@ export class TweetsComponent implements OnInit {
|
||||
|
||||
console.log(this.tweets);
|
||||
|
||||
this.http.get<Tweet[]>('http://127.0.0.1:8000/getMoreTweets/'+this.tweets[this.tweets.length-1].tweet_id+'/').subscribe(data => {
|
||||
console.log(data)
|
||||
this.http.get<Tweet[]>(
|
||||
'http://' + environment.location + ':' + environment.port + '/getMoreTweets/' + this.tweets[this.tweets.length - 1].tweet_id + '/'
|
||||
).subscribe(data => {
|
||||
console.log(data);
|
||||
|
||||
if(data.length == 0){
|
||||
this._snackbarService.show("Keine weiteren Tweets vorhanden","Schließen");
|
||||
if (data.length === 0) {
|
||||
this._snackbarService.show('Keine weiteren Tweets vorhanden', 'Schließen');
|
||||
}
|
||||
|
||||
|
||||
for(let tweet of data){
|
||||
let position = tweet.text.search(": http");
|
||||
tweet.text = tweet.text.substring(0,position);
|
||||
for (const tweet of data) {
|
||||
const position = tweet.text.search(': http');
|
||||
tweet.text = tweet.text.substring(0, position);
|
||||
this.tweets.push(tweet);
|
||||
}
|
||||
}
|
||||
@@ -61,18 +64,18 @@ export class TweetsComponent implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
fillTweets(){
|
||||
fillTweets() {
|
||||
|
||||
this.http.get<Tweet[]>('http://127.0.0.1:8000/getSixTweets/').subscribe(data => {
|
||||
console.log(data)
|
||||
for(let tweet of data){
|
||||
let position = tweet.text.search(": http");
|
||||
tweet.text = tweet.text.substring(0,position);
|
||||
this.tweets.push(tweet);
|
||||
}
|
||||
this.http.get<Tweet[]>('http://' + environment.location + ':' + environment.port + '/getSixTweets/').subscribe(data => {
|
||||
console.log(data);
|
||||
for (const tweet of data) {
|
||||
const position = tweet.text.search(': http');
|
||||
tweet.text = tweet.text.substring(0, position);
|
||||
this.tweets.push(tweet);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,12 +3,13 @@ import {HttpClient} from '@angular/common/http';
|
||||
import {Observable} from 'rxjs';
|
||||
import {IFeed} from '../interfaces/feed.interface';
|
||||
import {delay} from 'rxjs/operators';
|
||||
import {environment} from '../../environments/environment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FeedService {
|
||||
private url = 'http://localhost:8000/feeds/';
|
||||
private url = 'http://' + environment.location + ':' + environment.port + '/feeds/';
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user