Don't upload file if "Use URL" is selected

## Issue
When pressing "Done", it will call the upload function, which usually results in a "please select a file" error, or the file being uploaded if a file was selected prior to switching to "Use Url".
This commit is contained in:
infinite-persistence 2022-02-09 20:44:03 +08:00 committed by Thomas Zarebczan
parent 02accb5c79
commit 0f5948d871

View file

@ -141,7 +141,11 @@ function SelectAsset(props: Props) {
type="submit"
label={useUrl ? __('Done') : __('Upload')}
disabled={!useUrl && (uploadStatus === STATUS.UPLOADING || !pathSelected || !fileSelected)}
onClick={() => doUploadAsset()}
onClick={() => {
if (!useUrl) {
doUploadAsset();
}
}}
/>
)}
<FormField