diff --git a/package.json b/package.json index f9a9c4f0..9431bc98 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gitea-react-toolkit", - "version": "1.11.1-rc.1", + "version": "2.0.0", "license": "MIT", "description": "A Gitea API React Toolkit Component Library", "homepage": "https://gitea-react-toolkit.netlify.com/", diff --git a/src/components/file/useFile.js b/src/components/file/useFile.js index c8c509db..ee1d810c 100644 --- a/src/components/file/useFile.js +++ b/src/components/file/useFile.js @@ -37,10 +37,11 @@ function useFile({ const branch = repository && (repository.branch || repository.default_branch); const [deleted, setDeleted] = useState(); - const _setBlob = useCallback((_blob) => { - if (blob && _blob && onConfirmClose) { - if (onConfirmClose()) - { + const _setBlob = useCallback(async (_blob) => { + if (blob && _blob && typeof onConfirmClose == 'function') { + const confirm = await onConfirmClose() + + if (confirm) { setBlob(_blob); } } else{