import React from "react";
import SideBar from "../elements/SideBar";
import Tag from "../elements/Tag";
import "../css/CategoryPage.css"
import {TagPreview} from "../elements/Preview";
class CategoryPage extends React.Component {
constructor(props: P, context: any) {
super(props, context);
this.props = props;
this.state = {
loadedtags: []
};
}
componentDidMount() {
this.loadTags();
}
render() {
return (
<>
Category Page
{this.state.loadedtags ? this.state.loadedtags.length + " different Tags" : ""}
Infos:
Default Tags:
{
this.setState({tag: "All"});
this.fetchVideoData("all");
}}>All
FullHd
LowQuality
HD
{this.state.loadedtags ?
this.state.loadedtags.map((m) => (
)) :
"loading"
}
>
);
}
/**
* load all available tags from db.
*/
loadTags() {
const updateRequest = new FormData();
updateRequest.append('action', 'getAllTags');
// fetch all videos available
fetch('/api/Tags.php', {method: 'POST', body: updateRequest})
.then((response) => response.json()
.then((result) => {
this.setState({loadedtags: result});
}))
.catch(() => {
console.log("no connection to backend");
});
}
}
export default CategoryPage;