Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nisum-scorecard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Venkaiah Naidu Singamchetty
nisum-scorecard
Commits
6ea669b2
Commit
6ea669b2
authored
Mar 17, 2024
by
Venkaiah Naidu Singamchetty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
loginpage loading added'
parent
f98887e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
index.jsx
src/pages/home/index.jsx
+14
-3
No files found.
src/pages/home/index.jsx
View file @
6ea669b2
import
React
,
{
useState
}
from
"react"
;
import
React
,
{
use
Effect
,
use
State
}
from
"react"
;
import
{
useNavigate
}
from
"react-router-dom"
;
import
axios
from
'axios'
;
import
{
base_url
}
from
"../../utils/constants"
;
import
{
loginUser
}
from
"../../redux/reducers/userSlice"
;
import
{
useDispatch
}
from
'react-redux'
import
Loading
from
'../../components/loading Component/Loading'
function
Home
()
{
const
navigate
=
useNavigate
();
const
dispatch
=
useDispatch
()
const
[
id
,
setId
]
=
useState
(
null
);
const
[
errorMsg
,
setErrorMsg
]
=
useState
(
""
)
const
[
loading
,
setLoading
]
=
useState
(
true
)
const
handleNavigate
=
()
=>
{
const
handleNavigate
=
async
()
=>
{
setLoading
(
true
)
if
(
id
!==
null
){
axios
.
post
(
`
${
base_url
}
/login`
,{
empId
:
Number
(
id
)})
await
axios
.
post
(
`
${
base_url
}
/login`
,{
empId
:
Number
(
id
)})
.
then
((
res
)
=>
{
setLoading
(
false
)
dispatch
(
loginUser
(
res
.
data
.
user
))
navigate
(
`/dashboard`
);
})
.
catch
((
error
)
=>
{
setLoading
(
false
)
setErrorMsg
(
"Not Authorized"
);
})
}
else
{
setLoading
(
false
)
navigate
(
`/`
);
}
};
useEffect
(()
=>
{
setLoading
(
false
)
},[])
if
(
loading
)
{
return
<
Loading
/>}
else
return
(
<
div
className=
"container py-10 px-10 mx-0 min-w-full h-screen flex items-center justify-center bg-blue-100 "
>
<
div
className=
""
>
...
...
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