fix: 🐛
This commit is contained in:
@@ -73,8 +73,12 @@ class StorageService {
|
|||||||
this.accounts = accountsStr ? JSON.parse(accountsStr) : []
|
this.accounts = accountsStr ? JSON.parse(accountsStr) : []
|
||||||
const currentAccountStr = window.localStorage.getItem(StorageKey.CURRENT_ACCOUNT)
|
const currentAccountStr = window.localStorage.getItem(StorageKey.CURRENT_ACCOUNT)
|
||||||
this.currentAccount = currentAccountStr ? JSON.parse(currentAccountStr) : null
|
this.currentAccount = currentAccountStr ? JSON.parse(currentAccountStr) : null
|
||||||
const feedTypeStr = window.localStorage.getItem(StorageKey.FEED_TYPE)
|
const feedType = window.localStorage.getItem(StorageKey.FEED_TYPE)
|
||||||
this.feedType = feedTypeStr ? JSON.parse(feedTypeStr) : 'relays'
|
if (feedType && ['following', 'relays'].includes(feedType)) {
|
||||||
|
this.feedType = feedType as 'following' | 'relays'
|
||||||
|
} else {
|
||||||
|
this.feedType = 'relays'
|
||||||
|
}
|
||||||
const noteListModeStr = window.localStorage.getItem(StorageKey.NOTE_LIST_MODE)
|
const noteListModeStr = window.localStorage.getItem(StorageKey.NOTE_LIST_MODE)
|
||||||
this.noteListMode =
|
this.noteListMode =
|
||||||
noteListModeStr && ['posts', 'postsAndReplies', 'pictures'].includes(noteListModeStr)
|
noteListModeStr && ['posts', 'postsAndReplies', 'pictures'].includes(noteListModeStr)
|
||||||
@@ -136,8 +140,7 @@ class StorageService {
|
|||||||
this.activeRelaySetId = activeRelaySetId
|
this.activeRelaySetId = activeRelaySetId
|
||||||
} else {
|
} else {
|
||||||
this.relaySets = JSON.parse(relaySetsStr)
|
this.relaySets = JSON.parse(relaySetsStr)
|
||||||
const activeRelaySetIdStr = window.localStorage.getItem(StorageKey.ACTIVE_RELAY_SET_ID)
|
this.activeRelaySetId = window.localStorage.getItem(StorageKey.ACTIVE_RELAY_SET_ID) ?? null
|
||||||
this.activeRelaySetId = activeRelaySetIdStr ? JSON.parse(activeRelaySetIdStr) : null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,10 +160,7 @@ class StorageService {
|
|||||||
setActiveRelaySetId(id: string | null) {
|
setActiveRelaySetId(id: string | null) {
|
||||||
this.activeRelaySetId = id
|
this.activeRelaySetId = id
|
||||||
if (id) {
|
if (id) {
|
||||||
window.localStorage.setItem(
|
window.localStorage.setItem(StorageKey.ACTIVE_RELAY_SET_ID, id)
|
||||||
StorageKey.ACTIVE_RELAY_SET_ID,
|
|
||||||
JSON.stringify(this.activeRelaySetId)
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
window.localStorage.removeItem(StorageKey.ACTIVE_RELAY_SET_ID)
|
window.localStorage.removeItem(StorageKey.ACTIVE_RELAY_SET_ID)
|
||||||
}
|
}
|
||||||
@@ -172,7 +172,7 @@ class StorageService {
|
|||||||
|
|
||||||
setFeedType(feedType: TFeedType) {
|
setFeedType(feedType: TFeedType) {
|
||||||
this.feedType = feedType
|
this.feedType = feedType
|
||||||
window.localStorage.setItem(StorageKey.FEED_TYPE, JSON.stringify(this.feedType))
|
window.localStorage.setItem(StorageKey.FEED_TYPE, this.feedType)
|
||||||
}
|
}
|
||||||
|
|
||||||
getThemeSetting() {
|
getThemeSetting() {
|
||||||
|
|||||||
Reference in New Issue
Block a user