Skip to content

Commit

Permalink
add url prefix and suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
maciaszczykm committed Oct 18, 2024
1 parent 3c777e1 commit a9c5733
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import {
fetchUsers,
} from '../../../account/Typeaheads'

const urlPrefix = 'https://'
const urlSuffix = '/oauth2/callback'

export function EditPluralOIDCClientModal({
open,
onClose,
Expand Down Expand Up @@ -55,9 +58,11 @@ function EditPluralOIDCClient({
)

const addUrl = useCallback(() => {
if (redirectUris.indexOf(url) > -1) return
const u = `${urlPrefix}${url}${urlSuffix}`

if (redirectUris.includes(u)) return

setRedirectUris([...redirectUris, url])
setRedirectUris([...redirectUris, u])
setUrl('')
}, [url, setUrl, redirectUris, setRedirectUris])

Expand Down Expand Up @@ -133,13 +138,11 @@ function EditPluralOIDCClient({
gap: theme.spacing.small,
}}
>
<div
css={{
display: 'flex',
}}
>
<div css={{ display: 'flex' }}>
<Input
value={url}
prefix={urlPrefix}
suffix={urlSuffix}
width="100%"
placeholder="Enter a redirect URI"
onChange={({ target: { value } }) => setUrl(value)}
Expand Down

0 comments on commit a9c5733

Please sign in to comment.