mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
split AddRepository component into two separate components to simplify the state handling
This commit is contained in:
@@ -49,21 +49,21 @@ const ImportRepositoryFromUrl: FC<Props> = ({ url, setImportPending }) => {
|
||||
});
|
||||
|
||||
const [valid, setValid] = useState({ namespaceAndName: false, contact: true, importUrl: false });
|
||||
const isValid = () => {
|
||||
return Object.values(valid).every(v => v);
|
||||
};
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState<Error | undefined>();
|
||||
const history = useHistory();
|
||||
const [t] = useTranslation("repos");
|
||||
|
||||
const isValid = () => Object.values(valid).every(v => v);
|
||||
|
||||
const handleImportLoading = (loading: boolean) => {
|
||||
setLoading(loading);
|
||||
setImportPending(loading);
|
||||
setLoading(loading);
|
||||
};
|
||||
|
||||
const submit = (event: FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
setError(undefined);
|
||||
const currentPath = history.location.pathname;
|
||||
handleImportLoading(true);
|
||||
apiClient
|
||||
|
||||
Reference in New Issue
Block a user