Skip to content

Commit

Permalink
fix: type not requestType
Browse files Browse the repository at this point in the history
  • Loading branch information
drewlyton committed Sep 26, 2024
1 parent 929907d commit e869f06
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export function RequestPermissionDialog({
const [hasTooManyRequests, setHasTooManyRequests] = useState<boolean>(false)
const [hasBeenDenied, setHasBeenDenied] = useState<boolean>(false)

// Get the available roles for the project
useEffect(() => {
if (!projectId || !client) return
client
Expand All @@ -81,6 +82,7 @@ export function RequestPermissionDialog({
.then((data) => setRoles(data))
}, [projectId, client])

// Set a default requestedRole based on the available roles
const requestedRole = useMemo(() => {
const hasEditor = roles?.find((role) => role.name === 'editor')
return hasEditor ? 'Editor' : 'Administrator'
Expand All @@ -92,7 +94,7 @@ export function RequestPermissionDialog({
.request<AccessRequest | null>({
url: `/access/project/${projectId}/requests`,
method: 'post',
body: {note, requestUrl: window?.location.href, requestedRole, requestType: 'role'},
body: {note, requestUrl: window?.location.href, requestedRole, type: 'role'},
})
.then((request) => {
if (request) {
Expand Down

0 comments on commit e869f06

Please sign in to comment.