@@ -36,6 +36,18 @@ const registerSchema = z.object({
3636
3737type RegisterFormData = z . infer < typeof registerSchema > ;
3838
39+ interface RegisterApiPayload {
40+ name : string ;
41+ specUrl : string ;
42+ description ?: string ;
43+ authType : string ;
44+ apiKey ?: string ;
45+ apiKeyHeader ?: string ;
46+ bearerToken ?: string ;
47+ basicUsername ?: string ;
48+ basicPassword ?: string ;
49+ }
50+
3951export default function RegisterApiPage ( ) {
4052 const router = useRouter ( ) ;
4153 const registerApi = useRegisterApi ( ) ;
@@ -59,7 +71,7 @@ export default function RegisterApiPage() {
5971 const onSubmit = async ( data : RegisterFormData ) => {
6072 setError ( null ) ;
6173 try {
62- const payload : any = {
74+ const payload : RegisterApiPayload = {
6375 name : data . name ,
6476 specUrl : data . specUrl ,
6577 description : data . description ,
@@ -78,8 +90,9 @@ export default function RegisterApiPage() {
7890
7991 await registerApi . mutateAsync ( payload ) ;
8092 router . push ( '/apis' ) ;
81- } catch ( err : any ) {
82- setError ( err . response ?. data ?. error || 'Failed to register API' ) ;
93+ } catch ( err ) {
94+ const axiosError = err as { response ?: { data ?: { error ?: string } } } ;
95+ setError ( axiosError . response ?. data ?. error || 'Failed to register API' ) ;
8396 }
8497 } ;
8598
@@ -155,7 +168,7 @@ export default function RegisterApiPage() {
155168 < Label > Authentication Type</ Label >
156169 < Select
157170 value = { authType }
158- onValueChange = { ( value ) => setValue ( 'authType' , value as any ) }
171+ onValueChange = { ( value ) => setValue ( 'authType' , value as RegisterFormData [ 'authType' ] ) }
159172 >
160173 < SelectTrigger >
161174 < SelectValue placeholder = "Select authentication type" />
0 commit comments