diff --git a/src/App/index.jsx b/src/App/index.jsx index 2748ba3..9d8e731 100644 --- a/src/App/index.jsx +++ b/src/App/index.jsx @@ -11,34 +11,58 @@ import ClearUserHandler from "../components/ClearUserHandler"; import ChangeThemeMotor from "../components/ChangeThemeMotor"; import ChangeThemeHandler from "../components/ChangeThemeHandler"; import ShareHandler from "../components/ShareHandler"; +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import { ReactQueryDevtools } from "@tanstack/react-query-devtools"; const persistor = persistStore(store); +const queryClient = new QueryClient(); + +import { createServer } from "miragejs"; + +let server = createServer({ + namespace: "/api", +}); + +server.get("/marvel-heroes-names", () => { + return { + data: [ + "Steve Rogers", + "Tony Stark", + "Natasha Romanova", + "Jennifer Walters", + ], + }; +}); + const App = () => { return ( - - - - - - - } /> - - + + + + + + + + } /> + + + + diff --git a/src/main.jsx b/src/main.jsx index 02ef3d3..3d42f66 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -2,4 +2,5 @@ import React from "react"; import ReactDOM from "react-dom/client"; import App from "./App"; import "@/assets/css/global.css"; + ReactDOM.createRoot(document.getElementById("root")).render(); diff --git a/src/pages/Home/components/Welcome/index.jsx b/src/pages/Home/components/Welcome/index.jsx index 1c7e9eb..531e686 100644 --- a/src/pages/Home/components/Welcome/index.jsx +++ b/src/pages/Home/components/Welcome/index.jsx @@ -3,27 +3,27 @@ import React, { useState } from "react"; import { useDispatch } from "react-redux"; import { updateUserName } from "../../../../store/features/user"; import ManualUserNameEnter from "./components/ManualUserNameEnter"; - -const MarvelHeroesNameList = [ - "Steve Rogers", - "Tony Stark", - "Natasha Romanova", - "Jennifer Walters", -]; +import useMarvelHeroesNames from "@/api/hooks/useMarvelHeroesNames"; +import Loading from "@/components/Loading"; const Welcome = () => { const [isOtherNameClicked, setIsOtherNameClicked] = useState(false); const dispatch = useDispatch(); + const { data: MarvelHeroesNameList, isLoading } = useMarvelHeroesNames(); + const handleSelectedUsername = (username) => dispatch(updateUserName(username)); return ( <> Primeiro, escolha seu nome - + + + + - {MarvelHeroesNameList.map((name) => ( + {MarvelHeroesNameList?.map((name) => ( - +