Broke out state into accountState and appState
This commit is contained in:
parent
e37865b2d2
commit
b8d3def32b
2 changed files with 24 additions and 9 deletions
19
utils/accountState.tsx
Normal file
19
utils/accountState.tsx
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { proxy } from "valtio";
|
||||
|
||||
interface AccountState {
|
||||
[key: string]: any
|
||||
|
||||
account: {
|
||||
authorized: boolean,
|
||||
language: 'en' | 'jp'
|
||||
}
|
||||
}
|
||||
|
||||
export const initialAccountState: AccountState = {
|
||||
account: {
|
||||
authorized: false,
|
||||
language: 'en'
|
||||
}
|
||||
}
|
||||
|
||||
export const accountState = proxy(initialAccountState)
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
import { proxy } from "valtio";
|
||||
|
||||
interface State {
|
||||
app: {
|
||||
authenticated: boolean
|
||||
},
|
||||
interface AppState {
|
||||
[key: string]: any
|
||||
|
||||
party: {
|
||||
id: string | undefined,
|
||||
editable: boolean,
|
||||
|
|
@ -27,10 +26,7 @@ interface State {
|
|||
}
|
||||
}
|
||||
|
||||
const state: State = {
|
||||
app: {
|
||||
authenticated: false
|
||||
},
|
||||
export const initialAppState: AppState = {
|
||||
party: {
|
||||
id: undefined,
|
||||
editable: false,
|
||||
|
|
@ -54,4 +50,4 @@ const state: State = {
|
|||
}
|
||||
}
|
||||
|
||||
export default proxy(state)
|
||||
export const appState = proxy(initialAppState)
|
||||
Loading…
Reference in a new issue