Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PortalMEC-React
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PortalMEC
PortalMEC-React
Commits
fe9a7a76
Commit
fe9a7a76
authored
3 years ago
by
vgm18
Browse files
Options
Downloads
Patches
Plain Diff
Added snackbar alert in case of errors on signUp
parent
99334b34
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!73
Develop
,
!69
Fixed upload page: recaptcha not implemented, lack of blocking (part one, two,...
,
!66
Before update vinicius
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Components/SignUpModal.js
+51
-23
51 additions, 23 deletions
src/Components/SignUpModal.js
with
51 additions
and
23 deletions
src/Components/SignUpModal.js
+
51
−
23
View file @
fe9a7a76
...
...
@@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/
import
React
,
{
useContext
}
from
'
react
'
;
import
React
,
{
useContext
,
useState
}
from
'
react
'
;
import
Modal
from
'
@material-ui/core/Modal
'
;
import
Backdrop
from
'
@material-ui/core/Backdrop
'
;
import
Fade
from
'
@material-ui/core/Fade
'
;
...
...
@@ -23,11 +23,27 @@ import styled from 'styled-components'
import
SignUpContainer
from
'
./SignUpContainerFunction.js
'
import
{
Store
}
from
'
../Store.js
'
import
{
authentication
}
from
'
./HelperFunctions/getAxiosConfig
'
import
Snackbar
from
'
@material-ui/core/Snackbar
'
;
import
MuiAlert
from
'
@material-ui/lab/Alert
'
;
//import {postRequest} from './HelperFunctions/getAxiosConfig'
export
function
Alert
(
props
)
{
return
<
MuiAlert
elevation
=
{
6
}
variant
=
"
filled
"
{...
props
}
/>
;
}
export
default
function
SignUpModal
(
props
)
{
const
{
state
,
dispatch
}
=
useContext
(
Store
)
const
[
snackbarOpened
,
handleSnackbar
]
=
useState
(
false
)
const
handleCloseSnackbar
=
(
event
,
reason
)
=>
{
if
(
reason
===
'
clickaway
'
)
{
return
;
}
handleSnackbar
(
false
);
}
function
handleSuccess
(
data
)
{
dispatch
({
type
:
'
USER_SIGNED_UP
'
,
...
...
@@ -36,6 +52,11 @@ export default function SignUpModal (props) {
})
props
.
handleClose
()
}
function
handleError
(
error
)
{
handleSnackbar
(
true
)
}
const
handleLoginInfo
=
(
newLogin
)
=>
{
const
url
=
`/auth`
const
payload
=
{
...
...
@@ -46,32 +67,39 @@ export default function SignUpModal (props) {
// terms_of_service : true,
// avatar: ""
}
authentication
(
url
,
payload
,
handleSuccess
,
(
error
)
=>
{
console
.
log
(
e
rror
)
})
authentication
(
url
,
payload
,
handleSuccess
,
handleE
rror
)
//postRequest(url, payload, handleSuccess, (error) => {console.log(error)})
}
return
(
<
StyledModalSignUp
aria
-
labelledby
=
"
transition-modal-title
"
aria
-
describedby
=
"
transition-modal-description
"
open
=
{
props
.
open
}
centered
=
"
true
"
onClose
=
{
props
.
handleClose
}
closeAfterTransition
BackdropComponent
=
{
Backdrop
}
BackdropProps
=
{{
timeout
:
500
,
}}
>
<
Fade
in
=
{
props
.
open
}
>
<
SignUpContainer
handleClose
=
{
props
.
handleClose
}
openLogin
=
{
props
.
openLogin
}
handleLoginInfo
=
{
handleLoginInfo
}
/
>
<
/Fade
>
<
/StyledModalSignUp
>
<>
<
Snackbar
open
=
{
snackbarOpened
}
autoHideDuration
=
{
1000
}
onClose
=
{
handleCloseSnackbar
}
anchorOrigin
=
{{
vertical
:
'
top
'
,
horizontal
:
'
right
'
}}
>
<
Alert
severity
=
"
error
"
>
Ocorreu
um
erro
ao
se
conectar
!<
/Alert
>
<
/Snackbar
>
<
StyledModalSignUp
aria
-
labelledby
=
"
transition-modal-title
"
aria
-
describedby
=
"
transition-modal-description
"
open
=
{
props
.
open
}
centered
=
"
true
"
onClose
=
{
props
.
handleClose
}
closeAfterTransition
BackdropComponent
=
{
Backdrop
}
BackdropProps
=
{{
timeout
:
500
,
}}
>
<
Fade
in
=
{
props
.
open
}
>
<
SignUpContainer
handleClose
=
{
props
.
handleClose
}
openLogin
=
{
props
.
openLogin
}
handleLoginInfo
=
{
handleLoginInfo
}
/
>
<
/Fade
>
<
/StyledModalSignUp
>
<
/
>
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment