Skip to content

Commit

Permalink
Merge pull request #622 from systemli/Disallow-users-to-change-the-ti…
Browse files Browse the repository at this point in the history
…cker-domain

🚸 Disallow users to change the ticker domain
  • Loading branch information
0x46616c6b authored Apr 28, 2024
2 parents b39fccf + 335ee3a commit 9c7cf90
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/ticker/form/Domain.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import { TextField } from '@mui/material'
import { FC } from 'react'
import { Controller, useFormContext } from 'react-hook-form'
import useAuth from '../../useAuth'

const Domain: FC = () => {
const { control } = useFormContext()
const { user } = useAuth()

return <Controller name="domain" control={control} render={({ field }) => <TextField {...field} label="Domain" margin="dense" required />} />
return (
<Controller
name="domain"
control={control}
render={({ field }) => <TextField {...field} label="Domain" margin="dense" required disabled={!user?.roles.includes('admin')} />}
/>
)
}

export default Domain

0 comments on commit 9c7cf90

Please sign in to comment.