correct load of categorypage on tag click

improved failing tests
This commit is contained in:
2020-06-24 21:47:22 +02:00
parent e640b36ce4
commit 753ea99693
8 changed files with 64 additions and 116 deletions

View File

@@ -1,13 +1,11 @@
import React from "react";
import "./Preview.css";
import Player from "../../pages/Player/Player";
import VideoContainer from "../VideoContainer/VideoContainer";
import {Spinner} from "react-bootstrap";
class Preview extends React.Component {
constructor(props, context) {
super(props, context);
this.props = props;
this.state = {
previewpicture: null,
@@ -68,37 +66,6 @@ class Preview extends React.Component {
}
export class TagPreview extends React.Component {
constructor(props, context) {
super(props, context);
this.props = props;
}
fetchVideoData(tag) {
console.log(tag);
const updateRequest = new FormData();
updateRequest.append('action', 'getMovies');
updateRequest.append('tag', tag);
console.log("fetching data");
// fetch all videos available
fetch('/api/videoload.php', {method: 'POST', body: updateRequest})
.then((response) => response.json()
.then((result) => {
console.log(result);
this.props.categorybinding(
<VideoContainer
data={result}
viewbinding={this.props.viewbinding}/>, tag
);
}))
.catch(() => {
console.log("no connection to backend");
});
}
render() {
return (
<div className='videopreview tagpreview' onClick={() => this.itemClick()}>
@@ -110,7 +77,7 @@ export class TagPreview extends React.Component {
}
itemClick() {
this.fetchVideoData(this.props.name);
this.props.categorybinding(this.props.name);
}
}