Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Amparo
Amparo-frontend
Commits
d31a7314
Commit
d31a7314
authored
1 year ago
by
João Silva
Browse files
Options
Download
Email Patches
Plain Diff
Rotas novas para Menu Medicamentos e Lista de Medicamentos
parent
e144ae66
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/AppRoutes.tsx
+10
-0
src/AppRoutes.tsx
src/pages/HomePaciente/HomePaciente.tsx
+1
-1
src/pages/HomePaciente/HomePaciente.tsx
src/pages/Login/Login.tsx
+15
-16
src/pages/Login/Login.tsx
src/pages/MenuMedicamentos/MenuMedicamentos.tsx
+9
-6
src/pages/MenuMedicamentos/MenuMedicamentos.tsx
src/routes/constans.ts
+2
-0
src/routes/constans.ts
with
37 additions
and
23 deletions
+37
-23
src/AppRoutes.tsx
View file @
d31a7314
...
...
@@ -11,6 +11,8 @@ import { CadastroMedico } from './pages/CadastroMedico/CadastroMedico';
import
{
Identificacao
}
from
'
./pages/Identificacao/Identificacao
'
;
import
HomeMedico
from
'
./pages/HomeMedico/HomeMedico
'
;
import
VisualizacaoPerfilMedico
from
'
./pages/VisualizarPerfilMedico/VisualizarPerfilMedico
'
;
import
MenuMedicamentos
from
'
./pages/MenuMedicamentos/MenuMedicamentos
'
;
import
ListaMedicamentos
from
'
./pages/ListaMedicamentos/ListaMedicamentos
'
;
export
default
function
AppRoutes
()
{
return
(
...
...
@@ -42,6 +44,14 @@ export default function AppRoutes() {
path
=
{
ROUTES
.
PERFIL_MEDICO
()
}
element
=
{
<
VisualizacaoPerfilMedico
/>
}
/>
<
Route
path
=
{
ROUTES
.
MENU_MEDICAMENTOS
()
}
element
=
{
<
MenuMedicamentos
/>
}
/>
<
Route
path
=
{
ROUTES
.
LISTA_MEDICAMENTOS
()
}
element
=
{
<
ListaMedicamentos
/>
}
/>
</
Routes
>
</
div
>
</
Router
>
...
...
This diff is collapsed.
Click to expand it.
src/pages/HomePaciente/HomePaciente.tsx
View file @
d31a7314
...
...
@@ -19,7 +19,7 @@ const HomePaciente = () => {
};
const
handleClickMedicamentos
=
()
=>
{
console
.
log
(
'
Cheguei aqui!!!
'
);
navigate
(
ROUTES
.
MENU_MEDICAMENTOS
()
);
};
const
handleClickInfo
=
()
=>
{
...
...
This diff is collapsed.
Click to expand it.
src/pages/Login/Login.tsx
View file @
d31a7314
...
...
@@ -18,23 +18,22 @@ export const Login: React.FC = () => {
const
[
dataStatus
,
setDataStatus
]
=
useState
<
Number
>
();
const
emailRegex
=
/^
[
a-zA-Z0-9._-
]
+@
[
a-zA-Z0-9.-
]
+
\.[
a-zA-Z
]{2,6}
$/
;
async
function
fetchData
(
email
:
String
,
psw
:
String
)
{
try
{
const
result
=
await
login_post
(
email
,
psw
);
// console.log(result.data);
setData
(
result
.
data
);
setDataStatus
(
result
.
status
)
// console.log("Status " +result.status);
if
(
result
.
status
==
201
||
result
.
status
==
200
)
{
console
.
log
(
"
login realizado com sucesso
"
);
navigate
(
'
/home/paciente
'
);
}
}
catch
(
error
){
console
.
error
(
'
Erro ao fazer login
'
,
error
);
setErro
(
"
Email ou senha inválidos.
"
)
async
function
fetchData
(
email
:
String
,
psw
:
String
)
{
try
{
const
result
=
await
login_post
(
email
,
psw
);
// console.log(result.data);
setData
(
result
.
data
);
setDataStatus
(
result
.
status
);
// console.log("Status " +result.status);
if
(
result
.
status
==
201
||
result
.
status
==
200
)
{
console
.
log
(
'
login realizado com sucesso
'
);
navigate
(
ROUTES
.
HOME_PACIENTE
());
}
}
catch
(
error
)
{
console
.
error
(
'
Erro ao fazer login
'
,
error
);
setErro
(
'
Email ou senha inválidos.
'
);
}
}
const
handleEmail
=
(
newEmail
:
string
)
=>
{
setEmail
(
newEmail
);
};
...
...
@@ -52,7 +51,7 @@ export const Login: React.FC = () => {
return
;
}
setErro
(
''
);
fetchData
(
email
,
password
)
fetchData
(
email
,
password
)
;
};
return
(
...
...
This diff is collapsed.
Click to expand it.
src/pages/MenuMedicamentos/MenuMedicamentos.tsx
View file @
d31a7314
...
...
@@ -2,18 +2,21 @@ import { CardMedicamentos } from '../../components/CardMedicamentos/cardMedicame
import
Footer
from
'
../../components/Footer/Footer
'
;
import
HeaderHome
from
'
../../components/HeaderHome/HeaderHome
'
;
import
'
./MenuMedicamentos.css
'
;
import
{
useNavigate
}
from
'
react-router-dom
'
;
import
{
ROUTES
}
from
'
../../routes/constans
'
;
export
default
function
MenuMedicamentos
()
{
const
navigate
=
useNavigate
();
const
handleClickMyList
=
()
=>
{
navigate
(
ROUTES
.
LISTA_MEDICAMENTOS
());
};
return
(
<>
<
HeaderHome
title
=
"Medicamentos"
type
=
"headerPage"
/>
<
div
className
=
"menu-medicamentos-container"
>
<
CardMedicamentos
iconType
=
"icon1"
onClick
=
{
()
=>
{
console
.
log
(
'
minha lista
'
);
}
}
/>
<
CardMedicamentos
iconType
=
"icon1"
onClick
=
{
handleClickMyList
}
/>
<
CardMedicamentos
iconType
=
"icon2"
onClick
=
{
()
=>
{
...
...
This diff is collapsed.
Click to expand it.
src/routes/constans.ts
View file @
d31a7314
...
...
@@ -9,4 +9,6 @@ export const ROUTES = {
LOGIN
:
()
=>
'
*
'
,
PERFIL_PACIENTE
:
()
=>
'
/perfil/paciente
'
,
PERFIL_MEDICO
:
()
=>
'
/perfil/medico
'
,
MENU_MEDICAMENTOS
:
()
=>
'
/menu/medicamentos
'
,
LISTA_MEDICAMENTOS
:
()
=>
'
/lista/medicamentos
'
,
};
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment