diff --git a/web-app/src/api/profile.ts b/web-app/src/api/profile.ts index ef2e171..240e03e 100644 --- a/web-app/src/api/profile.ts +++ b/web-app/src/api/profile.ts @@ -48,3 +48,21 @@ export function getSelectedProfile(route: RouteLocation): string { } return name } + +const LAST_PROFILE_USED_KEY = 'last-profile-used' + +export function saveLastProfileUsed(route: RouteLocation) { + try { + const profileName = getSelectedProfile(route) + const existing = localStorage.getItem(LAST_PROFILE_USED_KEY) + if (existing === null || existing !== profileName) { + localStorage.setItem(LAST_PROFILE_USED_KEY, profileName) + } + } catch { + localStorage.removeItem(LAST_PROFILE_USED_KEY) + } +} + +export function getLastProfileUsed(): string | null { + return localStorage.getItem(LAST_PROFILE_USED_KEY) +} diff --git a/web-app/src/components/AccountCard.vue b/web-app/src/components/AccountCard.vue index c8a21d1..1c1a030 100644 --- a/web-app/src/components/AccountCard.vue +++ b/web-app/src/components/AccountCard.vue @@ -34,18 +34,28 @@ function goToAccount() { }