feat: replace window.confirm with showConfirm

This commit is contained in:
Yidadaa
2023-06-28 23:40:39 +08:00
parent 0140f771c6
commit 3298961748
8 changed files with 89 additions and 24 deletions

View File

@@ -5,6 +5,7 @@ import ResetIcon from "../icons/reload.svg";
import { ISSUE_URL } from "../constant";
import Locale from "../locales";
import { downloadAs } from "../utils";
import { showConfirm } from "./ui-lib";
interface IErrorBoundaryState {
hasError: boolean;
@@ -57,10 +58,13 @@ export class ErrorBoundary extends React.Component<any, IErrorBoundaryState> {
<IconButton
icon={<ResetIcon />}
text="Clear All Data"
onClick={() =>
confirm(Locale.Settings.Actions.ConfirmClearAll) &&
this.clearAndSaveData()
}
onClick={async () => {
if (
await showConfirm(Locale.Settings.Actions.ConfirmClearAll)
) {
this.clearAndSaveData();
}
}}
bordered
/>
</div>