File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 33 deleteAllMyNotifications ,
44 deleteMyNotification ,
55} from "@/api/notifications" ;
6- import type { EnrichedNotification } from "@/dto/notifications" ;
6+ import type { Notification } from "@/dto/notifications" ;
77
88export const useDeleteNotificationMutation = defineMutation ( ( ) => {
99 const queryCache = useQueryCache ( ) ;
@@ -12,12 +12,14 @@ export const useDeleteNotificationMutation = defineMutation(() => {
1212 mutation : ( id : string ) => deleteMyNotification ( id ) ,
1313 onMutate : ( id : string ) => {
1414 // optimistic: remove the notification from the "notifications" query
15- const prev = queryCache . getQueryData < { data : EnrichedNotification [ ] } > ( [
15+ const prev = queryCache . getQueryData < { data : Notification [ ] } > ( [
1616 "notifications" ,
1717 ] ) || {
1818 data : [ ] ,
1919 } ;
20- const newData = ( prev . data || [ ] ) . filter ( ( n ) => n . id !== id ) ;
20+ const newData = ( prev . data || [ ] ) . filter (
21+ ( n ) => ( n as Notification ) . id !== id ,
22+ ) ;
2123 queryCache . setQueryData ( [ "notifications" ] , { ...prev , data : newData } ) ;
2224 // cancel ongoing queries
2325 queryCache . cancelQueries ( { key : [ "notifications" ] } ) ;
You can’t perform that action at this time.
0 commit comments