File tree Expand file tree Collapse file tree 3 files changed +6
-10
lines changed
components/datarooms/settings/delete-dataroooom
api/teams/[teamId]/datarooms/[id] Expand file tree Collapse file tree 3 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ import { Input } from "@/components/ui/input";
1818import { Modal } from "@/components/ui/modal" ;
1919
2020import { useAnalytics } from "@/lib/analytics" ;
21- import { useMediaQuery } from "@/lib/utils/use-media-query" ;
2221
2322function DeleteDataroomModal ( {
2423 dataroomId,
@@ -38,8 +37,6 @@ function DeleteDataroomModal({
3837 const [ deleting , setDeleting ] = useState ( false ) ;
3938
4039 async function deleteDataroom ( ) {
41- const dataroomsCount = teamInfo ?. teams . length ?? 1 ;
42-
4340 return new Promise ( ( resolve , reject ) => {
4441 setDeleting ( true ) ;
4542
@@ -66,8 +63,6 @@ function DeleteDataroomModal({
6663 } ) ;
6764 }
6865
69- const { isMobile } = useMediaQuery ( ) ;
70-
7166 return (
7267 < Modal
7368 showModal = { showDeleteDataroomModal }
Original file line number Diff line number Diff line change @@ -134,9 +134,10 @@ export default async function handle(
134134 user . userId === ( session . user as CustomUser ) . id ,
135135 ) ;
136136 if ( ! isUserAdmin ) {
137- return res
138- . status ( 403 )
139- . json ( { message : "You are not permitted to perform this action" } ) ;
137+ return res . status ( 403 ) . json ( {
138+ message :
139+ "You are not permitted to perform this action. Only admin and managers can delete datarooms." ,
140+ } ) ;
140141 }
141142
142143 await prisma . dataroom . delete ( {
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export default function Settings() {
1919 const teamInfo = useTeam ( ) ;
2020 const teamId = teamInfo ?. currentTeam ?. id ;
2121
22- const { isDatarooms, isDataroomsPlus } = usePlan ( ) ;
22+ const { isBusiness , isDatarooms, isDataroomsPlus } = usePlan ( ) ;
2323
2424 if ( ! dataroom ) {
2525 return < div > Loading...</ div > ;
@@ -84,7 +84,7 @@ export default function Settings() {
8484 }
8585 />
8686 < DuplicateDataroom dataroomId = { dataroom . id } teamId = { teamId } />
87- { isDatarooms || isDataroomsPlus ? (
87+ { isBusiness || isDatarooms || isDataroomsPlus ? (
8888 < DeleteDataroom
8989 dataroomId = { dataroom . id }
9090 dataroomName = { dataroom . name }
You can’t perform that action at this time.
0 commit comments