YesPlayMusic/packages/web/states/persistedUiStates.ts
2022-07-11 11:06:41 +08:00

20 lines
487 B
TypeScript

import { proxy, subscribe } from 'valtio'
interface PersistedUiStates {
loginPhoneCountryCode: string
loginType: 'phone' | 'email' | 'qrCode'
}
const initPersistedUiStates: PersistedUiStates = {
loginPhoneCountryCode: '+86',
loginType: 'qrCode',
}
const persistedUiStates = proxy<PersistedUiStates>(initPersistedUiStates)
subscribe(persistedUiStates, () => {
localStorage.setItem('persistedUiStates', JSON.stringify(persistedUiStates))
})
export default persistedUiStates