-
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.
Merge pull request from /feature/api-exemplo
Feature/api exemplo
- Loading branch information
Showing
6 changed files
with
245 additions
and
49 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,7 +1,39 @@ | ||
function ModulosEducacionais_small() { | ||
import { useQuery } from "@tanstack/react-query"; | ||
|
||
import ApiAvasus from "../services/ApiAvasus"; | ||
|
||
export default function ModulosEducacionais_small() { | ||
let page = 1; | ||
let limit = 3; | ||
const { data, isLoading }: any = useQuery({ | ||
queryFn: () => | ||
ApiAvasus(`http://0.0.0.0:3004/cursos?_page=${page}&_limit=${limit}`), | ||
queryKey: ["modulosSmall"], | ||
}); | ||
|
||
if (isLoading) { | ||
return <h1>Loading...</h1>; | ||
} | ||
|
||
return ( | ||
<div>ModulosEducacionais_small</div> | ||
) | ||
<> | ||
<h2>ModulosEducacionais_small</h2> | ||
<div> | ||
<div>Mais populares</div> | ||
{/* Conteúdo paginado */} | ||
<div> | ||
<ol id="modulos-lista"></ol> | ||
{data?.map((data: any) => { | ||
return ( | ||
<li key={data.id}> | ||
<img src={data.capa} /> | ||
{data.id} | ||
</li> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
<span>Ver mais</span> | ||
</> | ||
); | ||
} | ||
|
||
export default ModulosEducacionais_small |
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,5 @@ | ||
import axios from "axios"; | ||
|
||
export default function ApiAvasus(url: string) { | ||
return axios.get(url).then((response) => response.data); | ||
} |
This file was deleted.
Oops, something went wrong.