import React, { useCallback } from 'react'; import { toastSuccess, toastError } from '~/client/util/apiNotification'; import { apiv3Post } from '~/client/util/apiv3-client'; // TODO: i18n export const PluginInstallerForm = (): JSX.Element => { const submitHandler = useCallback(async(e) => { e.preventDefault(); const formData = e.target.elements; const { 'pluginInstallerForm[url]': { value: url }, // 'pluginInstallerForm[ghBranch]': { value: ghBranch }, // 'pluginInstallerForm[ghTag]': { value: ghTag }, } = formData; const pluginInstallerForm = { url, // ghBranch, // ghTag, }; try { await apiv3Post('/plugins-extension', { pluginInstallerForm }); toastSuccess('Plugin Install Successed!'); } catch (err) { toastError(err); // logger.error(err); } }, []); return (
); };