Skip to content

Commit

Permalink
Merge pull request #42 from fga-eps-mds/191-ArrumarPaginasR1
Browse files Browse the repository at this point in the history
(#191) - Arrumar paginas da R1
  • Loading branch information
mibasFerraz authored Dec 6, 2023
2 parents 111a887 + 0aa21a6 commit d1aa2ad
Show file tree
Hide file tree
Showing 50 changed files with 1,991 additions and 870 deletions.
2 changes: 1 addition & 1 deletion .env.dev
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PRINT_GO_API_GATEWAY_URL=http://localhost:4000
REACT_APP_API_URL=http://localhost:4000
15 changes: 15 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"react-dom": "^18.2.0",
"react-hook-form": "^7.47.0",
"react-icons": "^4.12.0",
"react-jwt": "^1.2.0",
"react-router-dom": "^6.17.0",
"react-scripts": "5.0.1",
"react-toastify": "^9.1.3",
Expand Down
51 changes: 32 additions & 19 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import {BrowserRouter, Routes , Route} from "react-router-dom"
import Home from "./pages/Home"
import { BrowserRouter, Routes, Route } from "react-router-dom";
import Home from "./pages/Home";
import CreateUserPage from "./pages/CreateUser";
import EditUserPage from "./pages/EditUser";
import Login from "./pages/Login";
Expand All @@ -12,26 +12,39 @@ import EditPrinter from "./pages/EditPrinter";
import PatternPrinter from "./pages/PatternPrinter";
import EditPattern from "./pages/EditPattern";
import PrintersList from "./pages/PrintersList";

import PatternList from "./pages/PatternList";
import ForgottenPasswordPage from "./pages/ForgottenPassword";
import { ToastContainer } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import RecoverPasswordPage from "./pages/RecoverPassword";
import PrivateRoutes from "./components/utils/PrivateRoutes";

function App() {
return (
<BrowserRouter>
<Routes>
<Route path="/" element={<Home />} />
<Route path="/cadastro" element={<CreateUserPage />} />
<Route path="/editarusuario" element={<EditUserPage/>}/>
<Route path="/login" element={<Login />} />
<Route path="/contato" element={<Contact />} />
<Route path="/quemsomos" element={<AboutUs />} />
<Route path="/mudarsenha" element={<ChangePassword />} />
<Route path="/cadastroImpressora" element={<RegisterPrinter />} />
<Route path="/editarImpressora" element={<EditPrinter />} />
<Route path="/padraoImpressora" element={<PatternPrinter />} />
<Route path="/editarPadrao" element={<EditPattern />} />
<Route path="/impressorascadastradas" element={<PrintersList/>}/>
</Routes>
</BrowserRouter>
<>
<BrowserRouter>
<Routes>
<Route element={<PrivateRoutes />}>
<Route path="/cadastro" element={<CreateUserPage />} />
<Route path="/editarusuario" element={<EditUserPage/>}/>
<Route path="/mudarsenha" element={<ChangePassword />} />
<Route path="/cadastroimpressora" element={<RegisterPrinter />} />
<Route path="/editarimpressora" element={<EditPrinter />} />
<Route path="/padraoimpressora" element={<PatternPrinter />} />
<Route path="/editarpadrao" element={<EditPattern />} />
<Route path="/impressorascadastradas" element={<PrintersList />} />
<Route path="/listapadroes" element={<PatternList />} />
</Route>
<Route path="/login" element={<Login />} />
<Route path="/" element={<Home />} />
<Route path="/contato" element={<Contact />} />
<Route path="/quemsomos" element={<AboutUs />} />
<Route path="/recuperarSenha" element={<RecoverPasswordPage/>} />
<Route path="/esqueciMinhaSenha" element={<ForgottenPasswordPage />} />
</Routes>
</BrowserRouter>
<ToastContainer />
</>
);
}

Expand Down
9 changes: 2 additions & 7 deletions src/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,18 @@ export async function login(email, password) {
}
}

export async function changePassword(newPassword, newPasswordConfirmation) {
export async function changePassword(data) {
const token = localStorage.getItem('jwt')

const headers = {
'Authorization': token
}

const data = {
novaSenha: newPassword,
confirmacaoNovaSenha: newPasswordConfirmation,
}

try {
const response = await api.post('/user/change-password', data, {headers});
return response;
} catch(error) {
console.log('Erro ao trocar de senha', error)
return {type: 'error', error};
}
}
}
10 changes: 10 additions & 0 deletions src/assets/arrow-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/assets/loggeduser.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions src/components/forms/EditPrinterForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { yupResolver } from "@hookform/resolvers/yup";
import "../../style/components/editPrinterForms.css";
import elipse6 from '../../assets/elipse6.svg';
import { getPrinterSchema } from "../utils/YupSchema";
import { Link } from "react-router-dom";

const fieldLabels = {
padrao: 'Padrão',
Expand Down Expand Up @@ -56,9 +57,11 @@ export default function EditPrinterForm() {

return (
<div id="editPrinter-card">
<div id="buttons">
<button className="form-button" type="button" id="voltar-bnt">Voltar</button>
</div>

<Link id="link-back" to="/impressorascadastradas">

Voltar</Link>

<header id="form-header">
Editar impressora
</header>
Expand Down
Loading

0 comments on commit d1aa2ad

Please sign in to comment.