remove related dispatches
This commit is contained in:
parent
25d0d16dbb
commit
ae5984d2f1
29 changed files with 260 additions and 236 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { map } from 'lodash'
|
||||
|
||||
import { useStatusesStore } from 'src/stores/statuses.js'
|
||||
import { useTimelinesStore } from 'src/stores/timelines.js'
|
||||
import { useUsersStore } from 'src/stores/users.js'
|
||||
|
||||
import {
|
||||
|
|
@ -75,10 +76,13 @@ const editStatus = ({
|
|||
mediaIds,
|
||||
contentType,
|
||||
})
|
||||
.then(({ data }) => {
|
||||
store.dispatch('addNewStatuses', {
|
||||
.then(({ data, timestamp }) => {
|
||||
useStatusesStore().addNewStatuses({
|
||||
statuses: [data],
|
||||
timestamp,
|
||||
})
|
||||
useTimelinesStore().addStatusesToTimeline('friends', undefined, {
|
||||
statuses: [data],
|
||||
timeline: 'friends',
|
||||
showImmediately: true,
|
||||
noIdUpdate: true, // To prevent missing notices on next pull.
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import { useNotificationsStore } from 'src/stores/notifications.js'
|
||||
|
||||
/* global process */
|
||||
function urlBase64ToUint8Array(base64String) {
|
||||
const padding = '='.repeat((4 - (base64String.length % 4)) % 4)
|
||||
|
|
@ -94,16 +96,15 @@ function sendSubscriptionToBackEnd(
|
|||
return responseData
|
||||
})
|
||||
}
|
||||
export async function initServiceWorker(store) {
|
||||
export async function initServiceWorker() {
|
||||
if (!isSWSupported()) return
|
||||
await getOrCreateServiceWorker()
|
||||
navigator.serviceWorker.addEventListener('message', (event) => {
|
||||
const { dispatch } = store
|
||||
const { type, ...rest } = event.data
|
||||
|
||||
switch (type) {
|
||||
case 'notificationClicked':
|
||||
dispatch('notificationClicked', { id: rest.id })
|
||||
useNotificationsStore().notificationClicked(rest.id)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue