Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dashboard
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
red-giant
dashboard
Commits
b4ee6740
Verified
Commit
b4ee6740
authored
3 years ago
by
Defendi Alberto
Browse files
Options
Downloads
Patches
Plain Diff
Replace with this hook since cookie request is unique.
parent
bd8fbef1
No related branches found
Branches containing commit
No related tags found
2 merge requests
!56
Refined auth flow and new website pages.
,
!45
Polished auth flow including ReservedRoute and role selection.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/AuthUser/SignInForm/SignInForm.tsx
+3
-3
3 additions, 3 deletions
src/components/AuthUser/SignInForm/SignInForm.tsx
with
3 additions
and
3 deletions
src/components/AuthUser/SignInForm/SignInForm.tsx
+
3
−
3
View file @
b4ee6740
import
React
,
{
FC
,
useC
ontext
,
useEffec
t
,
useState
}
from
'
react
'
;
import
React
,
{
FC
,
useC
allback
,
useContex
t
,
useState
}
from
'
react
'
;
import
axios
from
'
axios
'
;
import
axios
from
'
axios
'
;
import
{
SubmitHandler
,
useForm
}
from
'
react-hook-form
'
;
import
{
SubmitHandler
,
useForm
}
from
'
react-hook-form
'
;
import
{
Button
}
from
'
@material-ui/core
'
;
import
{
Button
}
from
'
@material-ui/core
'
;
...
@@ -20,7 +20,7 @@ export const SignInForm: FC = () => {
...
@@ -20,7 +20,7 @@ export const SignInForm: FC = () => {
const
{
setRole
,
setIsAuth
}
=
useContext
(
AuthContext
);
const
{
setRole
,
setIsAuth
}
=
useContext
(
AuthContext
);
const
[
cookie
,
setCookie
]
=
useState
<
string
>
(
''
);
const
[
cookie
,
setCookie
]
=
useState
<
string
>
(
''
);
use
Effect
(()
=>
{
use
Callback
(()
=>
{
let
isMounted
=
true
;
let
isMounted
=
true
;
if
(
isMounted
)
if
(
isMounted
)
fetchCookie
().
then
((
cookieResponse
)
=>
setCookie
(
cookieResponse
));
fetchCookie
().
then
((
cookieResponse
)
=>
setCookie
(
cookieResponse
));
...
@@ -28,7 +28,7 @@ export const SignInForm: FC = () => {
...
@@ -28,7 +28,7 @@ export const SignInForm: FC = () => {
return
()
=>
{
return
()
=>
{
isMounted
=
false
;
isMounted
=
false
;
};
};
},
[]);
},
[
cookie
]);
const
{
control
,
errors
,
setError
,
handleSubmit
}
=
useForm
<
CredentialsType
>
({
const
{
control
,
errors
,
setError
,
handleSubmit
}
=
useForm
<
CredentialsType
>
({
defaultValues
,
defaultValues
,
...
...
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