import { useTranslation, Trans } from 'react-i18next' import useAsync from '@/shared/hooks/use-async' import { deleteJSON } from '@/infrastructure/fetch-json' import { OLModalBody, OLModalFooter } from '@/shared/components/ol/ol-modal' import OLButton from '@/shared/components/ol/ol-button' import OLNotification from '@/shared/components/ol/ol-notification' import { debugConsole } from '@/utils/debugging' import { GitSyncModalStatus } from '../../types/git-sync-types' type GitSyncUnlinkUnavailableModalProps = { handleHide: () => void setModalStatus: (modalStatus: GitSyncModalStatus) => void projectId: string } const GitSyncUnlinkUnavailableModal = ({ handleHide, setModalStatus, projectId, }: GitSyncInitModalProps) => { const { t } = useTranslation() const { error, isLoading, runAsync, } = useAsync() const handleUnlink = () => { runAsync(deleteJSON(`/project/${projectId}/github-sync`)) .then(() => setModalStatus('need-export')) .catch(err => debugConsole.error(err?.data?.message || err?.message || err)) } return ( <> {error && ( : <> ]} /> ) : ( t('something_went_wrong_server') ) } /> )}
{t('unlink_github_repository')} {t('cancel')}
) } export default GitSyncUnlinkUnavailableModal