Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
greg
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
it-bott-integrasjoner
greg
Merge requests
!204
Modify register step form for guests
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Modify register step form for guests
GREG-120-reg-form-validation
into
master
Overview
5
Commits
4
Pipelines
5
Changes
1
Merged
Andreas Ellewsen
requested to merge
GREG-120-reg-form-validation
into
master
3 years ago
Overview
5
Commits
4
Pipelines
5
Changes
1
Expand
Passport Country now displays two letter code after selection.
A heading has been added for identity information.
An error message is now displayed if the user inputs both national id and passport information.
Resolves: GREG-120
Edited
3 years ago
by
Andreas Ellewsen
0
0
Merge request reports
Viewing commit
4b2ce2c3
Prev
Next
Show latest version
1 file
+
7
−
12
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Verified
4b2ce2c3
Simplify guest fetching
· 4b2ce2c3
Andreas Ellewsen
authored
3 years ago
frontend/src/hooks/useGuests/index.tsx
+
7
−
12
Options
import
{
useEffect
,
useState
}
from
'
react
'
import
{
FetchedGuest
,
Guest
}
from
'
interfaces
'
import
{
parseIdentity
,
parseRole
}
from
'
utils
'
import
{
parseIdentity
,
parseRole
,
fetchJsonOpts
}
from
'
utils
'
const
useGuests
=
()
=>
{
const
[
guests
,
setGuests
]
=
useState
<
Guest
[]
>
([])
const
getGuestsInfo
=
async
()
=>
{
try
{
const
response
=
await
fetch
(
'
/api/ui/v1/guests/?format=json
'
)
const
jsonResponse
=
await
response
.
json
()
if
(
response
.
ok
)
{
const
persons
=
await
jsonResponse
const
getGuestsInfo
=
()
=>
fetch
(
'
/api/ui/v1/guests/
'
,
fetchJsonOpts
())
.
then
((
response
)
=>
(
response
.
ok
?
response
.
json
()
:
[]))
.
then
((
persons
)
=>
{
setGuests
(
persons
.
map
(
(
person
:
FetchedGuest
):
Guest
=>
({
@@ -28,11 +26,8 @@ const useGuests = () => {
})
)
)
}
}
catch
(
error
)
{
setGuests
([])
}
}
})
.
catch
(()
=>
setGuests
([]))
const
reloadGuests
=
()
=>
{
getGuestsInfo
()
Loading