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";
|
import { proxy } from "valtio";
|
||||||
|
|
||||||
interface State {
|
interface AppState {
|
||||||
app: {
|
[key: string]: any
|
||||||
authenticated: boolean
|
|
||||||
},
|
|
||||||
party: {
|
party: {
|
||||||
id: string | undefined,
|
id: string | undefined,
|
||||||
editable: boolean,
|
editable: boolean,
|
||||||
|
|
@ -27,10 +26,7 @@ interface State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const state: State = {
|
export const initialAppState: AppState = {
|
||||||
app: {
|
|
||||||
authenticated: false
|
|
||||||
},
|
|
||||||
party: {
|
party: {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
editable: false,
|
editable: false,
|
||||||
|
|
@ -54,4 +50,4 @@ const state: State = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default proxy(state)
|
export const appState = proxy(initialAppState)
|
||||||
Loading…
Reference in a new issue