From 29ea39bc63c6b38a49e741436d2afc7cd18a6594 Mon Sep 17 00:00:00 2001 From: Ian Bolton Date: Wed, 11 May 2022 15:56:15 -0400 Subject: [PATCH] Reset localstorage on fresh login (#194) --- pkg/client/src/app/layout/SidebarApp/SidebarApp.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/client/src/app/layout/SidebarApp/SidebarApp.tsx b/pkg/client/src/app/layout/SidebarApp/SidebarApp.tsx index 8f415f7346..9966f1d3ad 100644 --- a/pkg/client/src/app/layout/SidebarApp/SidebarApp.tsx +++ b/pkg/client/src/app/layout/SidebarApp/SidebarApp.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useEffect } from "react"; import { NavLink, useHistory, useLocation } from "react-router-dom"; import { useTranslation } from "react-i18next"; import { @@ -67,6 +67,14 @@ export const SidebarApp: React.FC = () => { const [selectedPersona, setSelectedPersona] = useLocalStorageContext( LocalStorageKey.selectedPersona ); + + useEffect(() => { + if (!selectedPersona) { + history.push("/"); + setSelectedPersona("Developer"); + } + }, []); + const [isDevIcon, setDevIcon] = React.useState(true); const Navigation = (