File tree Expand file tree Collapse file tree
routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.apikeys Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ const CreateApiKeySchema = z.object({
101101 . refine ( ( date ) => date . getTime ( ) > Date . now ( ) , "Expiration must be in the future" )
102102 . optional ( )
103103 ) ,
104- presetId : z . string ( ) . trim ( ) . min ( 1 ) . optional ( ) ,
104+ presetId : z . string ( ) . trim ( ) . min ( 1 ) ,
105105 taskScope : z . enum ( [ "all" , "selected" ] ) . optional ( ) ,
106106 taskIdentifiers : z
107107 . array ( z . string ( ) )
@@ -562,7 +562,7 @@ function NewApiKeyDialog({
562562 const [ open , setOpen ] = useState ( false ) ;
563563 const [ name , setName ] = useState ( "" ) ;
564564 const [ expiresAt , setExpiresAt ] = useState < Date > ( ) ;
565- const defaultPresetId = presets ?. find ( ( preset ) => preset . available ) ?. id ?? "" ;
565+ const defaultPresetId = presets ?. find ( ( preset ) => preset . available ) ?. id ?? "FULL_ACCESS " ;
566566 const [ presetId , setPresetId ] = useState ( defaultPresetId ) ;
567567 const [ taskScope , setTaskScope ] = useState < "all" | "selected" > ( "all" ) ;
568568 const [ selectedTasks , setSelectedTasks ] = useState < string [ ] > ( [ ] ) ;
Original file line number Diff line number Diff line change @@ -24,17 +24,14 @@ export function validateCreateApiKeyPreset({
2424 const fullAccess = { presetId : FULL_ACCESS_PRESET_ID , usesTaskSelection : false } ;
2525
2626 if ( presets === null ) {
27- if ( presetId !== undefined || hasTaskParameters ) {
27+ if ( presetId !== FULL_ACCESS_PRESET_ID || hasTaskParameters ) {
2828 throw new Error ( "API key access presets are not available" ) ;
2929 }
3030 return fullAccess ;
3131 }
3232
3333 if ( ! presetId ) {
34- if ( hasTaskParameters ) {
35- throw new Error ( "A preset is required when selecting tasks" ) ;
36- }
37- return fullAccess ;
34+ throw new Error ( "A preset is required" ) ;
3835 }
3936
4037 const preset = presets . find ( ( candidate ) => candidate . id === presetId ) ;
You can’t perform that action at this time.
0 commit comments