diff --git a/packages/desktop/views/login/components/ProfileCardActionsMenu.svelte b/packages/desktop/views/login/components/ProfileCardActionsMenu.svelte index 00c333150a..09628b7b54 100644 --- a/packages/desktop/views/login/components/ProfileCardActionsMenu.svelte +++ b/packages/desktop/views/login/components/ProfileCardActionsMenu.svelte @@ -1,8 +1,9 @@ diff --git a/packages/desktop/views/settings/views/profile/DeleteProfile.svelte b/packages/desktop/views/settings/views/profile/DeleteProfile.svelte index 3f14d34c8b..01d28892f3 100644 --- a/packages/desktop/views/settings/views/profile/DeleteProfile.svelte +++ b/packages/desktop/views/settings/views/profile/DeleteProfile.svelte @@ -4,6 +4,7 @@ import { localize } from '@core/i18n' import { PopupId, openPopup } from '@desktop/auxiliary/popup' import SettingsSection from '../SettingsSection.svelte' + import { getActiveProfileId } from '@core/profile/stores' function onDeleteClick(): void { openPopup({ @@ -13,7 +14,7 @@ title: localize('popups.deleteProfile.title'), alert: { variant: 'warning', text: localize('popups.deleteProfile.confirmation') }, confirmText: localize('actions.delete'), - onConfirm: deleteProfile, + onConfirm: () => deleteProfile(getActiveProfileId() as string), }, }) } diff --git a/packages/shared/src/lib/contexts/settings/actions/deleteProfile.ts b/packages/shared/src/lib/contexts/settings/actions/deleteProfile.ts index 1438d0fa64..ce6b1da019 100644 --- a/packages/shared/src/lib/contexts/settings/actions/deleteProfile.ts +++ b/packages/shared/src/lib/contexts/settings/actions/deleteProfile.ts @@ -1,7 +1,7 @@ import { AppContext } from '@core/app/enums' import { removeProfileFolder } from '@core/profile' import { logout, removeAllProfileData } from '@core/profile/actions' -import { activeProfileId, profiles } from '@core/profile/stores' +import { profiles } from '@core/profile/stores' import { routerManager } from '@core/router/stores' import { get } from 'svelte/store' @@ -10,13 +10,8 @@ import { get } from 'svelte/store' * the file system, and logs the user out * @returns A Promise that resolves to void. */ -export async function deleteProfile(): Promise { +export async function deleteProfile(profileId: string): Promise { try { - const _activeProfileId = get(activeProfileId) - if (!_activeProfileId) { - return - } - /** * CAUTION: Logout must occur before the profile is removed * from the Svelte store list of profiles. @@ -27,13 +22,13 @@ export async function deleteProfile(): Promise { * CAUTION: The profile and its data must be removed from the * app's list of profiles that lives as a Svelte store. */ - removeAllProfileData(_activeProfileId) + removeAllProfileData(profileId) /** * CAUTION: This removes the actual directory for the profile, * so it should occur last. */ - await removeProfileFolder(_activeProfileId) + await removeProfileFolder(profileId) /** * NOTE: If there are no more profiles, then the user should be diff --git a/packages/shared/src/locales/en.json b/packages/shared/src/locales/en.json index 06f68cb2d3..e32e2ade0e 100644 --- a/packages/shared/src/locales/en.json +++ b/packages/shared/src/locales/en.json @@ -991,7 +991,7 @@ "empty": "The error log is empty." }, "deleteProfile": { - "title": "Delete profile", + "title": "Delete {name} profile", "confirmation": "Are you sure you want to delete this profile? This operation cannot be undone.", "typePassword": "Type your password to confirm." },