Skip to content

Commit

Permalink
fix(auth): logout not redirect to auth screen
Browse files Browse the repository at this point in the history
  • Loading branch information
kangfenmao committed Dec 5, 2023
1 parent 9f86002 commit e6bd4ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,17 @@ const router = createBrowserRouter([
])

const App: React.FC = () => {
const [ready, setReady] = useState(false)
const hasAuthScope = !!localStorage.vortexnotes_auth_scope
const [ready, setReady] = useState(hasAuthScope)

useEffect(() => {
if (localStorage.vortexnotes_auth_scope) {
if (hasAuthScope) {
setReady(true)
fetchConfig()
} else {
fetchConfig().then(() => setReady(true))
}
}, [])
}, [hasAuthScope])

if (!ready) {
return (
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Navbar: React.FC<Props> = () => {
const onLogout = () => {
localStorage.removeItem('vortexnotes_passcode')
window.$http = getAxiosInstance()
navigate('/')
window.location.reload()
}

const onMenuItemClick = () => {
Expand Down

0 comments on commit e6bd4ef

Please sign in to comment.