Просмотр исходного кода

refactor: update AccessTokenForm to use IAccessTokenInfo type for submitHandler

reiji-h 1 год назад
Родитель
Сommit
cbf714fddb
1 измененных файлов с 4 добавлено и 6 удалено
  1. 4 6
      apps/app/src/client/components/Me/AccessTokenForm.tsx

+ 4 - 6
apps/app/src/client/components/Me/AccessTokenForm.tsx

@@ -3,14 +3,12 @@ import React from 'react';
 
 
 import { useTranslation } from 'next-i18next';
 import { useTranslation } from 'next-i18next';
 
 
+import type { IAccessTokenInfo } from '~/interfaces/access-token';
+
 const MAX_DESCRIPTION_LENGTH = 200;
 const MAX_DESCRIPTION_LENGTH = 200;
 
 
 type AccessTokenFormProps = {
 type AccessTokenFormProps = {
-  submitHandler: (info: {
-    expiredAt: Date,
-    scope: string[],
-    description: string,
-  }) => Promise<void>;
+  submitHandler: (info: IAccessTokenInfo) => Promise<void>;
 }
 }
 
 
 // TODO: Implement scope selection
 // TODO: Implement scope selection
@@ -26,7 +24,7 @@ export const AccessTokenForm = React.memo((props: AccessTokenFormProps): JSX.Ele
     const form = new FormData(e.currentTarget);
     const form = new FormData(e.currentTarget);
     const expiredAtDate = new Date(form.get('expiredAt') as string);
     const expiredAtDate = new Date(form.get('expiredAt') as string);
     const description = form.get('description') as string;
     const description = form.get('description') as string;
-    const scope = []; // form.getAll('scope') as string[];
+    const scope = []; // TODO: Implement scope selection
 
 
     submitHandler({
     submitHandler({
       expiredAt: expiredAtDate,
       expiredAt: expiredAtDate,