-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
151 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
const API_KEY = '5b119d53fa5e770c3fc666d15d4c947f' | ||
const API_BASE = 'https://api.themoviedb.org/3' | ||
|
||
|
||
|
||
const basicFetch = async (endpoint) => { | ||
const request = await fetch(`${API_BASE}${endpoint}`) | ||
const json = await request.json() | ||
return json | ||
} | ||
|
||
|
||
export default { | ||
|
||
|
||
getHomelist: async () => { | ||
return [ | ||
{ | ||
slug: 'originals', | ||
title: 'Originais do netflix', | ||
items: await basicFetch(`/discover/tv?with_network=213$languange=Pt_BR&api_key=${API_KEY}`) | ||
}, | ||
{ | ||
slug: 'treding', | ||
title: 'Recomendados para Voçe', | ||
items: await basicFetch(`/trending/all/week?languange=Pt_BR&api_key=${API_KEY}`) | ||
}, | ||
{ | ||
slug: 'topreted', | ||
title: 'Em alta', | ||
items: await basicFetch(`/movie/top_rated?languange=Pt_BR&api_key=${API_KEY}`) | ||
}, | ||
{ | ||
slug: 'action', | ||
title: 'Ação', | ||
items: await basicFetch(`/discover/movie?with_genres=28&languange=Pt_BR&api_key=${API_KEY}`) | ||
}, | ||
{ | ||
slug: 'Comedy', | ||
title: 'comedia', | ||
items: await basicFetch(`/discover/movie?with_genres=35&languange=Pt_BR&api_key=${API_KEY}`) | ||
}, | ||
{ | ||
slug: 'horror', | ||
title: 'Terror', | ||
items: await basicFetch(`/discover/movie?with_genres=27&languange=Pt_BR&api_key=${API_KEY}`) | ||
}, | ||
{ | ||
slug: 'romance', | ||
title: 'romance', | ||
items: await basicFetch(`/discover/movie?with_genres=10749&languange=Pt_BR&api_key=${API_KEY}`) | ||
}, | ||
{ | ||
slug: 'documentary', | ||
title: 'Documentarios', | ||
items: await basicFetch(`/discover/movie?with_genres=99&languange=Pt_BR&api_key=${API_KEY}`) | ||
} | ||
|
||
]; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
const API_KEY = '5b119d53fa5e770c3fc666d15d4c947f' | ||
const API_BASE = 'https://api.themoviedb.org/3' | ||
|
||
|
||
|
||
const basicFetch = async (endpoint) => { | ||
const request = await fetch(`${API_BASE}${endpoint}`) | ||
const json = await request.json() | ||
return json | ||
} | ||
|
||
|
||
export default { | ||
|
||
|
||
getHomelist: async () => { | ||
return [ | ||
{ | ||
slug: 'originals', | ||
title: 'Originais do netflix', | ||
items: await basicFetch(`/discover/tv?with_network=213$languange=Pt_BR&api_key=${API_KEY}`) | ||
}, | ||
{ | ||
slug: 'treding', | ||
title: 'Recomendados para Você', | ||
items: await basicFetch(`/trending/all/week?languange=Pt_BR&api_key=${API_KEY}`) | ||
}, | ||
{ | ||
slug: 'toprated', | ||
title: 'Em alta', | ||
items: await basicFetch(`/movie/top_rated?languange=Pt_BR&api_key=${API_KEY}`) | ||
}, | ||
{ | ||
slug: 'action', | ||
title: 'Ação', | ||
items: await basicFetch(`/discover/movie?with_genres=28&languange=Pt_BR&api_key=${API_KEY}`) | ||
}, | ||
{ | ||
slug: 'Comedy', | ||
title: 'comedia', | ||
items: await basicFetch(`/discover/movie?with_genres=35&languange=Pt_BR&api_key=${API_KEY}`) | ||
}, | ||
{ | ||
slug: 'horror', | ||
title: 'Terror', | ||
items: await basicFetch(`/discover/movie?with_genres=27&languange=Pt_BR&api_key=${API_KEY}`) | ||
}, | ||
{ | ||
slug: 'romance', | ||
title: 'romance', | ||
items: await basicFetch(`/discover/movie?with_genres=10749&languange=Pt_BR&api_key=${API_KEY}`) | ||
}, | ||
{ | ||
slug: 'documentary', | ||
title: 'Documentarios', | ||
items: await basicFetch(`/discover/movie?with_genres=99&languange=Pt_BR&api_key=${API_KEY}`) | ||
} | ||
|
||
]; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React, { useState, useEffect } from 'react' | ||
import Tmdb from '../Tmdb' | ||
import { View,Text } from 'react-native' | ||
|
||
export default () => { | ||
const [movieList, setmovieList] = useState([]) | ||
|
||
useEffect(() => { | ||
const loadAll = async () => { | ||
let list = await Tmdb.getHomelist() | ||
setmovieList(list) | ||
/////// | ||
} | ||
|
||
loadAll() | ||
}, []) | ||
|
||
return ( | ||
<> | ||
{movieList.map((item, key) => ( | ||
<Text>{item.title}</Text> | ||
))} | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters