Refactor to just CommandBar and GlobalState (#337)
* Refactor to just CommandBar and GlobalState * @Irev-Dev review: consolidate uses of useContext
This commit is contained in:
@ -5,13 +5,18 @@ import { invoke } from '@tauri-apps/api/tauri'
|
||||
import { VITE_KC_SITE_BASE_URL, VITE_KC_API_BASE_URL } from '../env'
|
||||
import { Themes, getSystemTheme } from '../lib/theme'
|
||||
import { paths } from '../Router'
|
||||
import { useAuthMachine } from '../hooks/useAuthMachine'
|
||||
import { useContext } from 'react'
|
||||
import { SettingsContext } from 'components/SettingsCommandProvider'
|
||||
import { useGlobalStateContext } from 'hooks/useGlobalStateContext'
|
||||
|
||||
const SignIn = () => {
|
||||
const { theme } = useContext(SettingsContext)
|
||||
const [_, send] = useAuthMachine()
|
||||
const {
|
||||
auth: { send },
|
||||
settings: {
|
||||
state: {
|
||||
context: { theme },
|
||||
},
|
||||
},
|
||||
} = useGlobalStateContext()
|
||||
|
||||
const appliedTheme = theme === Themes.System ? getSystemTheme() : theme
|
||||
const signInTauri = async () => {
|
||||
// We want to invoke our command to login via device auth.
|
||||
|
Reference in New Issue
Block a user