Skip to content

Commit

Permalink
caminho tela de cadastro para perfil adicionado #37
Browse files Browse the repository at this point in the history
  • Loading branch information
biancabsouza23 committed May 28, 2024
1 parent a1bb1e9 commit 3b86837
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Fronted/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import React from "react";
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
import PaginaInicial from "./componentes/inicial";
import FormularioCadastro from "./componentes/FormularioCadastro";
import MeuPerfil from "./componentes/MeuPerfil"; // Importe o componente MeuPerfil

function App() {
return (
<Router>
<Routes>
<Route path="/" element={<PaginaInicial />} />
<Route path="/cadastro" element={<FormularioCadastro />} />
<Route path="/meu-perfil" element={<MeuPerfil />} /> {/* Nova rota */}
</Routes>
</Router>
);
Expand Down
7 changes: 6 additions & 1 deletion Fronted/src/componentes/FormularioCadastro.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// src/componentes/FormularioCadastro.js
import React, { useState } from 'react';
import { useNavigate } from 'react-router-dom'; // Importa useNavigate
import './FormularioCadastro.css';

const FormularioCadastro = () => {
Expand All @@ -10,6 +10,8 @@ const FormularioCadastro = () => {
password: '',
});

const navigate = useNavigate(); // Inicializa o useNavigate

const handleChange = (e) => {
const { name, value } = e.target;
setFormData((prevFormData) => ({
Expand All @@ -22,6 +24,9 @@ const FormularioCadastro = () => {
e.preventDefault();
console.log('Dados do formulário enviados:', formData);
// Aqui você pode adicionar a lógica para enviar os dados para o servidor

// Redireciona para a página de perfil após o envio do formulário
navigate('/meu-perfil');
};

return (
Expand Down

0 comments on commit 3b86837

Please sign in to comment.