cleanup
This commit is contained in:
parent
1aff1ac4e7
commit
c611788e77
19 changed files with 59 additions and 122 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { defineStore } from 'pinia'
|
||||
|
||||
import { storage } from 'src/lib/storage.js'
|
||||
|
||||
const storageKey = 'pleroma-fe-drafts'
|
||||
|
|
@ -18,13 +19,13 @@ const storageKey = 'pleroma-fe-drafts'
|
|||
const getStorageData = async () => await storage.getItem(storageKey)
|
||||
|
||||
const saveDraftToStorage = async (draft) => {
|
||||
const currentData = await getStorageData() ?? {}
|
||||
const currentData = (await getStorageData()) ?? {}
|
||||
currentData[draft.id] = JSON.parse(JSON.stringify(draft))
|
||||
await storage.setItem(storageKey, currentData)
|
||||
}
|
||||
|
||||
const deleteDraftFromStorage = async (ids) => {
|
||||
const currentData = await getStorageData() ?? {}
|
||||
const currentData = (await getStorageData()) ?? {}
|
||||
ids.forEach((id) => {
|
||||
delete currentData[id]
|
||||
})
|
||||
|
|
@ -33,7 +34,7 @@ const deleteDraftFromStorage = async (ids) => {
|
|||
|
||||
export const useDraftsStore = defineStore('drafts', {
|
||||
state: () => ({
|
||||
drafts: new Map()
|
||||
drafts: new Map(),
|
||||
}),
|
||||
getters: {
|
||||
draftsByTypeAndRefId(state) {
|
||||
|
|
@ -71,5 +72,5 @@ export const useDraftsStore = defineStore('drafts', {
|
|||
ids.forEach((id) => this.abandonDraft(id))
|
||||
await deleteDraftFromStorage(ids)
|
||||
},
|
||||
}
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -97,7 +97,9 @@ export const settingsMap = {
|
|||
}
|
||||
|
||||
export const defaultState = () => ({
|
||||
config: Object.fromEntries(Object.keys(settingsMap).map((key) => [key, null]))
|
||||
config: Object.fromEntries(
|
||||
Object.keys(settingsMap).map((key) => [key, null]),
|
||||
),
|
||||
})
|
||||
|
||||
export const useProfileConfigStore = defineStore('profileConfig', {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { defineStore } from 'pinia'
|
|||
import { useAnnouncementsStore } from 'src/stores/announcements.js'
|
||||
import { useBookmarkFoldersStore } from 'src/stores/bookmark_folders.js'
|
||||
import { useChatsStore } from 'src/stores/chats.js'
|
||||
import { useDraftsStore } from 'src/stores/drafts.js'
|
||||
import { useEmojiStore } from 'src/stores/emoji.js'
|
||||
import { useFollowRequestsStore } from 'src/stores/follow_requests.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
|
|
@ -14,14 +15,13 @@ import { useListsStore } from 'src/stores/lists.js'
|
|||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useNotificationsStore } from 'src/stores/notifications.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useProfileConfigStore } from 'src/stores/profile_config.js'
|
||||
import { useShoutStore } from 'src/stores/shout.js'
|
||||
import { useStatusesStore } from 'src/stores/statuses.js'
|
||||
import { useStreamingStore } from 'src/stores/streaming.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
import { useProfileConfigStore } from 'src/stores/profile_config.js'
|
||||
import { useTimelinesStore } from 'src/stores/timelines.js'
|
||||
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
||||
import { useDraftsStore } from 'src/stores/drafts.js'
|
||||
|
||||
import { revokeToken } from 'src/api/oauth.js'
|
||||
import {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue