Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: show confirmation when logging out

thecodrr2c8771fd0c65
diff --git a/apps/web/src/components/dialogs/confirm.js b/apps/web/src/components/dialogs/confirm.js
index c22492217..4e2367fba 100644
--- a/apps/web/src/components/dialogs/confirm.js
+++ b/apps/web/src/components/dialogs/confirm.js
@@ -90,3 +90,14 @@ export function showMultiDeleteConfirmation(type) {
noText: "Cancel",
});
}
+
+export function showLogoutConfirmation() {
+ return confirm(Icon.Logout, {
+ title: `Logout`,
+ subtitle: `Are you sure you want to logout?`,
+ message:
+ "Logging out will delete all local data and reset the app. Make sure you have synced all your data before logging out.",
+ yesText: `Yes`,
+ noText: "No",
+ });
+}
diff --git a/apps/web/src/views/settings.js b/apps/web/src/views/settings.js
index 7f626d300..d600f33e3 100644
--- a/apps/web/src/views/settings.js
+++ b/apps/web/src/views/settings.js
@@ -7,6 +7,7 @@ import { useStore as useSettingStore } from "../stores/setting-store";
import AccentItem from "../components/accent-item";
import accents from "../theme/accents";
import { showLogInDialog } from "../components/dialogs/logindialog";
+import { showLogoutConfirmation } from "../components/dialogs/confirm";
import { upgrade } from "../common/upgrade";
import useSystemTheme from "../utils/use-system-theme";
import download from "../utils/download";
@@ -175,7 +176,7 @@ function Settings(props) {
<Button
variant="list"
onClick={async () => {
- await logout();
+ if (await showLogoutConfirmation()) await logout();
}}
>
<TextWithTip