mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
notification subscription
This commit is contained in:
parent
9e52ec5469
commit
1b8b356432
@ -7,8 +7,8 @@ export default {
|
||||
notificationAdded: {
|
||||
subscribe: withFilter(
|
||||
() => pubsub.asyncIterator(NOTIFICATION_ADDED),
|
||||
(payload, variables) => {
|
||||
return payload.notificationAdded.to.id === variables.userId
|
||||
(payload, variables, context) => {
|
||||
return payload.notificationAdded.to.id === context.user?.id
|
||||
},
|
||||
),
|
||||
},
|
||||
|
||||
@ -38,5 +38,5 @@ type Mutation {
|
||||
}
|
||||
|
||||
type Subscription {
|
||||
notificationAdded(userId: ID!): NOTIFIED
|
||||
notificationAdded: NOTIFIED
|
||||
}
|
||||
|
||||
@ -137,11 +137,6 @@ export default {
|
||||
},
|
||||
subscribeToMore: {
|
||||
document: notificationAdded(),
|
||||
variables() {
|
||||
return {
|
||||
userId: this.user.id,
|
||||
}
|
||||
},
|
||||
updateQuery: (previousResult, { subscriptionData }) => {
|
||||
const {
|
||||
data: { notificationAdded: newNotification },
|
||||
|
||||
@ -245,8 +245,8 @@ export const notificationAdded = () => {
|
||||
${postFragment}
|
||||
${groupFragment}
|
||||
|
||||
subscription notifications($userId: ID!) {
|
||||
notificationAdded(userId: $userId) {
|
||||
subscription notifications {
|
||||
notificationAdded {
|
||||
id
|
||||
read
|
||||
reason
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user