diff --git a/main.riot b/main.riot new file mode 100644 index 0000000..9b17ec8 --- /dev/null +++ b/main.riot @@ -0,0 +1,44 @@ +
+

{props.title}

+

Loading

+

Résultats {state.message}

+ + + + + + + +
\ No newline at end of file diff --git a/search.riot b/search.riot new file mode 100644 index 0000000..6e22268 --- /dev/null +++ b/search.riot @@ -0,0 +1,17 @@ + + + + + + diff --git a/service.js b/service.js new file mode 100644 index 0000000..42e1b60 --- /dev/null +++ b/service.js @@ -0,0 +1,59 @@ +function makeServiceajax(){ + let urlBase = "https://api.themoviedb.org/3/" + let apiKey = "3501a3f71bbe8a2f282d299a14602396" + + let service = { + searchMovie, doRequest, discover, detailsMovie, sorting, trading, getGenres + }; + + function doRequest(search){ + return fetch(urlBase+"search/movie?api_key"+apiKey+"&language=fr&query"+search+"&page=1") + .then(response => response.json()) + .then(data => data) + } + + function searchMovie(search){ + return fetch(urlBase+"search/movie?api_key="+apiKey+"&language=fr&query="+search+"&page=1") + .then(response => response.json()) + .then(data => data) + } + + function discover(){ + return fetch(urlBase+"discover/movie?api_key="+apiKey+"&language=fr&app&page=1") + .then(response => response.json()) + .then(data => data) + } + + + function detailsMovie(movie_id){ + return fetch(urlBase+"discover/movie"+movie_id+"?api_key="+apiKey+"&language=fr&app&page=1") + .then(response => response.json()) + .then(data => data) + } + + function genres(){ + return fetch(urlBase+"discover/movie?api_key="+apiKey+"&language=fr&app&page=1") + .then(response => response.json()) + .then(data => data) + } + + function getGenres(){ + return fetch(urlBase+"genre/movie/list?api_key="+apiKey+"&language=fr&app&page=1") + .then(response => response.json()) + .then(data => data) + } + + function sorting(type){ + return fetch(urlBase+"discover/movie/?api_key="+apiKey+ type +"&language=fr&app&page=1") + .then(response => response.json()) + .then(data => data) + } + + function trading(){ + return fetch(urlBase + "trending/all/day?api_key=" + apiKey + "&language=fr&page=1") + .then(response => response.json()) + .then(data => data) + } + + return service +} \ No newline at end of file diff --git a/sorting.riot b/sorting.riot new file mode 100644 index 0000000..ded1526 --- /dev/null +++ b/sorting.riot @@ -0,0 +1,24 @@ + + + + + + + \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..c0cdcd4 --- /dev/null +++ b/style.css @@ -0,0 +1,3 @@ +h3{ + size: 20px; +} \ No newline at end of file