mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2024-12-12 12:19:02 +08:00
20 lines
487 B
TypeScript
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
|