Keep App component loaded while navigating (#247)

* Make /settings not throw away App component

* Make App not reload for Onboarding

* Close sidebar when navigating to /settings

* Use centralized constants for route pathnames

* Clean up a few stray raw path literals
This commit is contained in:
Frank Noirot
2023-08-10 13:30:32 -04:00
committed by GitHub
parent dbb94d7e95
commit 3a93839a2d
10 changed files with 163 additions and 97 deletions

View File

@ -6,6 +6,7 @@ import { invoke } from '@tauri-apps/api/tauri'
import { useNavigate } from 'react-router-dom'
import { VITE_KC_SITE_BASE_URL, VITE_KC_API_BASE_URL } from '../env'
import { getSystemTheme } from '../lib/getSystemTheme'
import { paths } from '../Router'
const SignIn = () => {
const navigate = useNavigate()
@ -21,7 +22,7 @@ const SignIn = () => {
host: VITE_KC_API_BASE_URL,
})
setToken(token)
navigate('/')
navigate(paths.INDEX)
} catch (error) {
console.error('login button', error)
}
@ -69,7 +70,9 @@ const SignIn = () => {
) : (
<ActionButton
Element="link"
to={`${VITE_KC_SITE_BASE_URL}/signin?callbackUrl=${encodeURIComponent(
to={`${VITE_KC_SITE_BASE_URL}${
paths.SIGN_IN
}?callbackUrl=${encodeURIComponent(
typeof window !== 'undefined' &&
window.location.href.replace('signin', '')
)}`}