Przeglądaj źródła

implement test ldap response type

yuken 3 lat temu
rodzic
commit
2ea75a3821

+ 3 - 2
packages/app/src/components/Admin/Security/LdapAuthTest.tsx

@@ -5,6 +5,7 @@ import { useTranslation } from 'next-i18next';
 import { toastSuccess, toastError } from '~/client/util/apiNotification';
 import { apiPost } from '~/client/util/apiv1-client';
 import loggerFactory from '~/utils/logger';
+import { IResTestLdap } from '~/interfaces/ldap';
 
 const logger = loggerFactory('growi:security:AdminLdapSecurityContainer');
 
@@ -37,7 +38,7 @@ export const LdapAuthTest = (props: LdapAuthTestProps): JSX.Element => {
    */
   const testLdapCredentials = async() => {
     try {
-      const response = await apiPost('/login/testLdap', {
+      const response = await apiPost<IResTestLdap>('/login/testLdap', {
         loginForm: {
           username,
           password,
@@ -46,7 +47,7 @@ export const LdapAuthTest = (props: LdapAuthTestProps): JSX.Element => {
 
       const {
         err, message, status, ldapConfiguration, ldapAccountInfo,
-      } = response as any;
+      } = response;
 
       // add logs
       if (err) {

+ 7 - 0
packages/app/src/interfaces/ldap.ts

@@ -0,0 +1,7 @@
+export interface IResTestLdap {
+  err?: any,
+  message: string,
+  status: string,
+  ldapConfiguration?: any,
+  ldapAccountInfo?: any,
+}