From 05a05ba034de060b7950758cb8b74b2fee9a32c1 Mon Sep 17 00:00:00 2001 From: Drew Lyton Date: Thu, 26 Sep 2024 12:02:53 -0400 Subject: [PATCH] chore: merge types --- .../core/studio/screens/RequestAccessScreen.tsx | 6 ++++-- .../RequestPermissionDialog.tsx | 15 +-------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/packages/sanity/src/core/studio/screens/RequestAccessScreen.tsx b/packages/sanity/src/core/studio/screens/RequestAccessScreen.tsx index fd1db0fc60f..1f4b2d50edd 100644 --- a/packages/sanity/src/core/studio/screens/RequestAccessScreen.tsx +++ b/packages/sanity/src/core/studio/screens/RequestAccessScreen.tsx @@ -13,7 +13,7 @@ import { import {Button, Dialog} from '../../../ui-components' import {NotAuthenticatedScreen} from './NotAuthenticatedScreen' -interface AccessRequest { +export interface AccessRequest { id: string status: 'pending' | 'accepted' | 'declined' resourceId: string @@ -22,6 +22,8 @@ interface AccessRequest { updatedAt: string updatedByUserId: string requestedByUserId: string + requestedRole: string + type: 'access' | 'role' note: string } @@ -127,7 +129,7 @@ export function RequestAccessScreen() { .request({ url: `/access/project/${projectId}/requests`, method: 'post', - body: {note, requestUrl: window?.location.href}, + body: {note, requestUrl: window?.location.href, type: 'access'}, }) .then((request) => { if (request) setHasPendingRequest(true) diff --git a/packages/sanity/src/structure/components/requestPermissionDialog/RequestPermissionDialog.tsx b/packages/sanity/src/structure/components/requestPermissionDialog/RequestPermissionDialog.tsx index 570745b4f55..28341ccc5a6 100644 --- a/packages/sanity/src/structure/components/requestPermissionDialog/RequestPermissionDialog.tsx +++ b/packages/sanity/src/structure/components/requestPermissionDialog/RequestPermissionDialog.tsx @@ -3,23 +3,10 @@ import {useEffect, useId, useMemo, useState} from 'react' import {type Role, useClient, useProjectId, useTranslation, useZIndex} from 'sanity' import {styled} from 'styled-components' +import {type AccessRequest} from '../../../core/studio/screens' import {Dialog} from '../../../ui-components' import {structureLocaleNamespace} from '../../i18n' -interface AccessRequest { - id: string - status: 'pending' | 'accepted' | 'declined' - resourceId: string - resourceType: 'project' - createdAt: string - updatedAt: string - updatedByUserId: string - requestedByUserId: string - requestedRole: string - requestType: string - note: string -} - const MAX_NOTE_LENGTH = 150 /** @internal */