|
@@ -2,25 +2,27 @@ import * as React from 'react';
|
2
|
2
|
import toast, { Toaster } from 'react-hot-toast';
|
3
|
3
|
import { useNavigate } from 'react-router-dom'
|
4
|
4
|
import jwt_decode from "jwt-decode";
|
|
5
|
+import {
|
|
6
|
+ // useSelector,
|
|
7
|
+ useDispatch } from "react-redux";
|
|
8
|
+// import { connect } from 'react-redux';
|
5
|
9
|
|
6
|
10
|
import {
|
7
|
|
- Paper, Box, Grid, Typography,
|
8
|
|
- TextField, Button, Avatar,
|
|
11
|
+ Paper, Box, Grid, Typography, TextField, Button, Avatar,
|
9
|
12
|
Backdrop, CircularProgress,
|
10
|
13
|
} from '@mui/material'
|
11
|
14
|
|
12
|
15
|
import { createTheme, ThemeProvider } from '@mui/material/styles';
|
13
|
16
|
|
14
|
17
|
import PersonIcon from '@mui/icons-material/Person';
|
15
|
|
-// import { useNavigate } from 'react-router-dom'
|
16
|
18
|
import { Copyright } from '../Components/Footer.js'
|
17
|
|
-// import { Link } from 'react-router-dom'
|
18
|
19
|
import useAuth from '../Auth/useAuth';
|
19
|
20
|
|
20
|
21
|
import { useFormik } from 'formik';
|
21
|
22
|
import * as Yup from 'yup';
|
22
|
23
|
|
23
|
24
|
import { Service } from '../Utils/HTTP.js'
|
|
25
|
+import { setToken } from '../Actions/index.js';
|
24
|
26
|
|
25
|
27
|
const LoginSchema = Yup.object().shape({
|
26
|
28
|
email: Yup
|
|
@@ -41,6 +43,8 @@ export function LoginCs() {
|
41
|
43
|
let navigate = useNavigate()
|
42
|
44
|
|
43
|
45
|
const [open, setOpen] = React.useState(false);
|
|
46
|
+ // const token = useSelector(state => state.token)
|
|
47
|
+ const dispatch = useDispatch();
|
44
|
48
|
const handleClose = () => false
|
45
|
49
|
|
46
|
50
|
const formik = useFormik({
|
|
@@ -74,6 +78,7 @@ export function LoginCs() {
|
74
|
78
|
body_token['pass'] = password;
|
75
|
79
|
body_token['passid'] = pass_id;
|
76
|
80
|
console.log("BODY TOKEN: ", body_token)
|
|
81
|
+ dispatch(setToken(token))
|
77
|
82
|
// let timestamp = exp * 1000;
|
78
|
83
|
// let restante = timestamp - Date.now();
|
79
|
84
|
|
|
@@ -190,3 +195,6 @@ export function LoginCs() {
|
190
|
195
|
|
191
|
196
|
);
|
192
|
197
|
}
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+// export default connect(mapStateToProps, mapDispatchToProps)(LoginCs);
|