Movie object now uses http functions when submitting a post for a movie.

This commit is contained in:
2017-10-20 18:08:31 +02:00
parent 45a84cbf85
commit b2f4151850

View File

@@ -7,6 +7,10 @@ import movieStyle from './styles/movieObjectStyle.jsx';
var MediaQuery = require('react-responsive');
import RequestButton from './buttons/request_button.jsx';
import { fetchJSON } from './http.jsx';
class MovieObject {
constructor(object) {
this.id = object.id;
@@ -27,9 +31,13 @@ class MovieObject {
requestMovie() {
// fetch('http://localhost:31459/api/v1/plex/request/' + this.id + '?type='+this.type, {
fetch('https://apollo.kevinmidboe.com/api/v1/plex/request/' + this.id + '?type='+this.type, {
method: 'POST'
});
// fetch('https://apollo.kevinmidboe.com/api/v1/plex/request/' + this.id + '?type='+this.type, {
// method: 'POST'
// });
fetchJSON('https://apollo.kevinmidboe.com/api/v1/plex/request/' + this.id + '?type='+this.type, 'POST')
.then((response) => {
console.log(response);
})
notify.show(this.title + ' requested!', 'success', 3000);
}
@@ -61,6 +69,7 @@ class MovieObject {
// TODO add request button class
return (
<div key={element_key}>
<Notifications />
@@ -89,7 +98,8 @@ class MovieObject {
</MediaQuery>
<span className='imdbLogo'>
<span className='imdbLogo'>
</span>
<div style={movieStyle.buttons}>